From d6407160581d7cdfdf456c0353357d1afc86758a Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 30 Nov 2023 12:31:19 -0700 Subject: [PATCH 1/6] Check for BK draft flag --- .../scripts/pipelines/pull_request/pipeline.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index 9c7b02eb98604..826b6ba9fbd94 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -39,6 +39,18 @@ const uploadPipeline = (pipelineContent: string | object) => { (async () => { try { + if (process.env.BUILDKITE_PULL_REQUEST_DRAFT) { + console.log( + 'Skipping CI for draft PR. If you need to run CI for this PR add the label xxxxxxx and retrigger CI.' + ); + + // Since we skip everything, including post-build, we need to at least make sure the commit status gets set + execSync('BUILD_SUCCESSFUL=true .buildkite/scripts/lifecycle/commit_status_complete.sh', { + stdio: 'inherit', + }); + process.exit(0); + } + const skippable = await areChangesSkippable(SKIPPABLE_PR_MATCHERS, REQUIRED_PATHS); if (skippable) { From f041187a48d8de8c0b93229fea1c0db6c476a9df Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 30 Nov 2023 13:41:27 -0700 Subject: [PATCH 2/6] Fix types, add pkg --- .buildkite/package.json | 3 ++- package.json | 1 + yarn.lock | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.buildkite/package.json b/.buildkite/package.json index d38af884828e5..c7421b425084a 100644 --- a/.buildkite/package.json +++ b/.buildkite/package.json @@ -15,6 +15,7 @@ "tslib": "*" }, "devDependencies": { + "@octokit/plugin-rest-endpoint-methods": "^10.2.0", "@types/chai": "^4.3.3", "@types/js-yaml": "^4.0.5", "@types/minimatch": "^3.0.5", @@ -30,4 +31,4 @@ "#pipeline-utils": "./pipeline-utils/index.ts", "#pipeline-utils/*": "./pipeline-utils/*" } -} +} \ No newline at end of file diff --git a/package.json b/package.json index f7ca215f20fd6..4aa2b1ea1e050 100644 --- a/package.json +++ b/package.json @@ -1280,6 +1280,7 @@ "@kbn/whereis-pkg-cli": "link:packages/kbn-whereis-pkg-cli", "@kbn/yarn-lock-validator": "link:packages/kbn-yarn-lock-validator", "@mapbox/vector-tile": "1.3.1", + "@octokit/plugin-rest-endpoint-methods": "^10.2.0", "@octokit/rest": "^16.35.0", "@openpgp/web-stream-tools": "^0.0.10", "@parcel/watcher": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index 2e609e33d4ae3..2d110a7fa3396 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6818,6 +6818,11 @@ resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-18.0.0.tgz#f43d765b3c7533fd6fb88f3f25df079c24fccf69" integrity sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw== +"@octokit/openapi-types@^19.0.2": + version "19.1.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-19.1.0.tgz#75ec7e64743870fc73e1ab4bc6ec252ecdd624dc" + integrity sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw== + "@octokit/plugin-paginate-rest@^1.1.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz#004170acf8c2be535aba26727867d692f7b488fc" @@ -6846,6 +6851,13 @@ "@octokit/types" "^2.0.1" deprecation "^2.3.1" +"@octokit/plugin-rest-endpoint-methods@^10.2.0": + version "10.2.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.2.0.tgz#eeaa4de97a2ae26404dea30ce3e17b11928e027c" + integrity sha512-ePbgBMYtGoRNXDyKGvr9cyHjQ163PbwD0y1MkDJCpkO2YH4OeXX40c4wYHKikHGZcpGPbcRLuy0unPUuafco8Q== + dependencies: + "@octokit/types" "^12.3.0" + "@octokit/plugin-rest-endpoint-methods@^7.1.2": version "7.2.3" resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.2.3.tgz#37a84b171a6cb6658816c82c4082ac3512021797" @@ -6948,6 +6960,13 @@ dependencies: "@octokit/openapi-types" "^18.0.0" +"@octokit/types@^12.3.0": + version "12.3.0" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-12.3.0.tgz#e3f8bc53f65ef551e19cc1a0fea15adadec17d2d" + integrity sha512-nJ8X2HRr234q3w/FcovDlA+ttUU4m1eJAourvfUUtwAWeqL8AsyRqfnLvVnYn3NFbUnsmzQCzLNdFerPwdmcDQ== + dependencies: + "@octokit/openapi-types" "^19.0.2" + "@octokit/types@^2.0.0", "@octokit/types@^2.0.1": version "2.16.2" resolved "https://registry.yarnpkg.com/@octokit/types/-/types-2.16.2.tgz#4c5f8da3c6fecf3da1811aef678fda03edac35d2" From 55590ea8073662f693a82cdb803958d7059fd671 Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 30 Nov 2023 13:41:43 -0700 Subject: [PATCH 3/6] Add isDraftPR request --- .buildkite/pipeline-utils/github/github.ts | 22 ++++++++++++++++++- .../pipelines/pull_request/pipeline.ts | 6 +++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.buildkite/pipeline-utils/github/github.ts b/.buildkite/pipeline-utils/github/github.ts index fc6ab42a69a5e..06665b7fcc1b4 100644 --- a/.buildkite/pipeline-utils/github/github.ts +++ b/.buildkite/pipeline-utils/github/github.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { Octokit, RestEndpointMethodTypes } from '@octokit/rest'; +import { Octokit } from '@octokit/rest'; +import { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods'; const github = new Octokit({ auth: process.env.GITHUB_TOKEN, @@ -25,6 +26,7 @@ export const getPrChanges = async ( ); } + // @ts-expect-error const files = await github.paginate(github.pulls.listFiles, { owner, repo, @@ -91,3 +93,21 @@ export const doAnyChangesMatch = async ( return anyFilesMatchRequired; }; + +export const isDraftPR = async ( + owner = process.env.GITHUB_PR_BASE_OWNER, + repo = process.env.GITHUB_PR_BASE_REPO, + prNumber: undefined | string | number = process.env.GITHUB_PR_NUMBER +) => { + if (!owner || !repo || !prNumber) { + throw Error( + "Couldn't retrieve Github PR info from environment variables in order to retrieve PR changes" + ); + } + + return await github.pulls.get({ + owner, + repo, + pull_number: typeof prNumber === 'number' ? prNumber : parseInt(prNumber, 10), + }); +}; diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index 826b6ba9fbd94..5fec44902c2b9 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -9,7 +9,7 @@ import { execSync } from 'child_process'; import fs from 'fs'; import prConfigs from '../../../pull_requests.json'; -import { areChangesSkippable, doAnyChangesMatch } from '#pipeline-utils'; +import { areChangesSkippable, doAnyChangesMatch, isDraftPR } from '#pipeline-utils'; const prConfig = prConfigs.jobs.find((job) => job.pipelineSlug === 'kibana-pull-request'); @@ -39,7 +39,9 @@ const uploadPipeline = (pipelineContent: string | object) => { (async () => { try { - if (process.env.BUILDKITE_PULL_REQUEST_DRAFT) { + // process.env.BUILDKITE_PULL_REQUEST_DRAFT + + if (await isDraftPR()) { console.log( 'Skipping CI for draft PR. If you need to run CI for this PR add the label xxxxxxx and retrigger CI.' ); From c33bdb4cf0b204e2b74323ae7e2a2a86065d3504 Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 30 Nov 2023 13:42:37 -0700 Subject: [PATCH 4/6] Fix return --- .buildkite/pipeline-utils/github/github.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.buildkite/pipeline-utils/github/github.ts b/.buildkite/pipeline-utils/github/github.ts index 06665b7fcc1b4..954d2407e51be 100644 --- a/.buildkite/pipeline-utils/github/github.ts +++ b/.buildkite/pipeline-utils/github/github.ts @@ -105,9 +105,11 @@ export const isDraftPR = async ( ); } - return await github.pulls.get({ - owner, - repo, - pull_number: typeof prNumber === 'number' ? prNumber : parseInt(prNumber, 10), - }); + return await github.pulls + .get({ + owner, + repo, + pull_number: typeof prNumber === 'number' ? prNumber : parseInt(prNumber, 10), + }) + .then((r) => r.data.draft); }; From b785fcd3ec5ac9b52a7c8d47ad40894a2f55ede3 Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 30 Nov 2023 13:49:14 -0700 Subject: [PATCH 5/6] Add type pkg to correct deps --- .buildkite/package-lock.json | 109 ++++++++++++++++----- .buildkite/package.json | 2 +- .buildkite/pipeline-utils/github/github.ts | 1 - package.json | 1 - yarn.lock | 19 ---- 5 files changed, 85 insertions(+), 47 deletions(-) diff --git a/.buildkite/package-lock.json b/.buildkite/package-lock.json index 745e1867af10a..6ae8cbbdac518 100644 --- a/.buildkite/package-lock.json +++ b/.buildkite/package-lock.json @@ -16,6 +16,7 @@ "tslib": "*" }, "devDependencies": { + "@octokit/plugin-rest-endpoint-methods": "^10.2.0", "@types/chai": "^4.3.3", "@types/js-yaml": "^4.0.5", "@types/minimatch": "^3.0.5", @@ -140,9 +141,9 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz", - "integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA==" + "version": "12.11.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz", + "integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==" }, "node_modules/@octokit/plugin-paginate-rest": { "version": "2.17.0", @@ -164,15 +165,33 @@ } }, "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz", - "integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.2.0.tgz", + "integrity": "sha512-ePbgBMYtGoRNXDyKGvr9cyHjQ163PbwD0y1MkDJCpkO2YH4OeXX40c4wYHKikHGZcpGPbcRLuy0unPUuafco8Q==", + "dev": true, "dependencies": { - "@octokit/types": "^6.34.0", - "deprecation": "^2.3.1" + "@octokit/types": "^12.3.0" + }, + "engines": { + "node": ">= 18" }, "peerDependencies": { - "@octokit/core": ">=3" + "@octokit/core": ">=5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.1.0.tgz", + "integrity": "sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw==", + "dev": true + }, + "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.3.0.tgz", + "integrity": "sha512-nJ8X2HRr234q3w/FcovDlA+ttUU4m1eJAourvfUUtwAWeqL8AsyRqfnLvVnYn3NFbUnsmzQCzLNdFerPwdmcDQ==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^19.0.2" } }, "node_modules/@octokit/request": { @@ -209,12 +228,24 @@ "@octokit/plugin-rest-endpoint-methods": "^5.12.0" } }, + "node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz", + "integrity": "sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==", + "dependencies": { + "@octokit/types": "^6.39.0", + "deprecation": "^2.3.1" + }, + "peerDependencies": { + "@octokit/core": ">=3" + } + }, "node_modules/@octokit/types": { - "version": "6.34.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz", - "integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==", + "version": "6.41.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.41.0.tgz", + "integrity": "sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==", "dependencies": { - "@octokit/openapi-types": "^11.2.0" + "@octokit/openapi-types": "^12.11.0" } }, "node_modules/@tsconfig/node10": { @@ -1757,9 +1788,9 @@ } }, "@octokit/openapi-types": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz", - "integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA==" + "version": "12.11.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz", + "integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==" }, "@octokit/plugin-paginate-rest": { "version": "2.17.0", @@ -1775,12 +1806,29 @@ "integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==" }, "@octokit/plugin-rest-endpoint-methods": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz", - "integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.2.0.tgz", + "integrity": "sha512-ePbgBMYtGoRNXDyKGvr9cyHjQ163PbwD0y1MkDJCpkO2YH4OeXX40c4wYHKikHGZcpGPbcRLuy0unPUuafco8Q==", + "dev": true, "requires": { - "@octokit/types": "^6.34.0", - "deprecation": "^2.3.1" + "@octokit/types": "^12.3.0" + }, + "dependencies": { + "@octokit/openapi-types": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.1.0.tgz", + "integrity": "sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw==", + "dev": true + }, + "@octokit/types": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.3.0.tgz", + "integrity": "sha512-nJ8X2HRr234q3w/FcovDlA+ttUU4m1eJAourvfUUtwAWeqL8AsyRqfnLvVnYn3NFbUnsmzQCzLNdFerPwdmcDQ==", + "dev": true, + "requires": { + "@octokit/openapi-types": "^19.0.2" + } + } } }, "@octokit/request": { @@ -1815,14 +1863,25 @@ "@octokit/plugin-paginate-rest": "^2.16.8", "@octokit/plugin-request-log": "^1.0.4", "@octokit/plugin-rest-endpoint-methods": "^5.12.0" + }, + "dependencies": { + "@octokit/plugin-rest-endpoint-methods": { + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz", + "integrity": "sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==", + "requires": { + "@octokit/types": "^6.39.0", + "deprecation": "^2.3.1" + } + } } }, "@octokit/types": { - "version": "6.34.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz", - "integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==", + "version": "6.41.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.41.0.tgz", + "integrity": "sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==", "requires": { - "@octokit/openapi-types": "^11.2.0" + "@octokit/openapi-types": "^12.11.0" } }, "@tsconfig/node10": { diff --git a/.buildkite/package.json b/.buildkite/package.json index c7421b425084a..dabded0e9a699 100644 --- a/.buildkite/package.json +++ b/.buildkite/package.json @@ -31,4 +31,4 @@ "#pipeline-utils": "./pipeline-utils/index.ts", "#pipeline-utils/*": "./pipeline-utils/*" } -} \ No newline at end of file +} diff --git a/.buildkite/pipeline-utils/github/github.ts b/.buildkite/pipeline-utils/github/github.ts index 954d2407e51be..263759826b16f 100644 --- a/.buildkite/pipeline-utils/github/github.ts +++ b/.buildkite/pipeline-utils/github/github.ts @@ -26,7 +26,6 @@ export const getPrChanges = async ( ); } - // @ts-expect-error const files = await github.paginate(github.pulls.listFiles, { owner, repo, diff --git a/package.json b/package.json index 4aa2b1ea1e050..f7ca215f20fd6 100644 --- a/package.json +++ b/package.json @@ -1280,7 +1280,6 @@ "@kbn/whereis-pkg-cli": "link:packages/kbn-whereis-pkg-cli", "@kbn/yarn-lock-validator": "link:packages/kbn-yarn-lock-validator", "@mapbox/vector-tile": "1.3.1", - "@octokit/plugin-rest-endpoint-methods": "^10.2.0", "@octokit/rest": "^16.35.0", "@openpgp/web-stream-tools": "^0.0.10", "@parcel/watcher": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index 2d110a7fa3396..2e609e33d4ae3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6818,11 +6818,6 @@ resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-18.0.0.tgz#f43d765b3c7533fd6fb88f3f25df079c24fccf69" integrity sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw== -"@octokit/openapi-types@^19.0.2": - version "19.1.0" - resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-19.1.0.tgz#75ec7e64743870fc73e1ab4bc6ec252ecdd624dc" - integrity sha512-6G+ywGClliGQwRsjvqVYpklIfa7oRPA0vyhPQG/1Feh+B+wU0vGH1JiJ5T25d3g1JZYBHzR2qefLi9x8Gt+cpw== - "@octokit/plugin-paginate-rest@^1.1.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz#004170acf8c2be535aba26727867d692f7b488fc" @@ -6851,13 +6846,6 @@ "@octokit/types" "^2.0.1" deprecation "^2.3.1" -"@octokit/plugin-rest-endpoint-methods@^10.2.0": - version "10.2.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.2.0.tgz#eeaa4de97a2ae26404dea30ce3e17b11928e027c" - integrity sha512-ePbgBMYtGoRNXDyKGvr9cyHjQ163PbwD0y1MkDJCpkO2YH4OeXX40c4wYHKikHGZcpGPbcRLuy0unPUuafco8Q== - dependencies: - "@octokit/types" "^12.3.0" - "@octokit/plugin-rest-endpoint-methods@^7.1.2": version "7.2.3" resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.2.3.tgz#37a84b171a6cb6658816c82c4082ac3512021797" @@ -6960,13 +6948,6 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@octokit/types@^12.3.0": - version "12.3.0" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-12.3.0.tgz#e3f8bc53f65ef551e19cc1a0fea15adadec17d2d" - integrity sha512-nJ8X2HRr234q3w/FcovDlA+ttUU4m1eJAourvfUUtwAWeqL8AsyRqfnLvVnYn3NFbUnsmzQCzLNdFerPwdmcDQ== - dependencies: - "@octokit/openapi-types" "^19.0.2" - "@octokit/types@^2.0.0", "@octokit/types@^2.0.1": version "2.16.2" resolved "https://registry.yarnpkg.com/@octokit/types/-/types-2.16.2.tgz#4c5f8da3c6fecf3da1811aef678fda03edac35d2" From e08d8464fb84519719beae2328242b2e548bd590 Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 30 Nov 2023 13:56:09 -0700 Subject: [PATCH 6/6] Add label support --- .buildkite/scripts/pipelines/pull_request/pipeline.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index 5fec44902c2b9..41a35c0bd6248 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -39,11 +39,10 @@ const uploadPipeline = (pipelineContent: string | object) => { (async () => { try { - // process.env.BUILDKITE_PULL_REQUEST_DRAFT - - if (await isDraftPR()) { + // Ideally could use process.env.BUILDKITE_PULL_REQUEST_DRAFT, but its not being set properly in CI + if (!GITHUB_PR_LABELS.includes('ci:run_on_draft') && (await isDraftPR())) { console.log( - 'Skipping CI for draft PR. If you need to run CI for this PR add the label xxxxxxx and retrigger CI.' + 'Skipping CI for draft PR. If you need to run CI for this PR add the label ci:run_on_draft and retrigger CI.' ); // Since we skip everything, including post-build, we need to at least make sure the commit status gets set