From 45591e31ceeaa91d136330c149f0bd0c22ed04ab Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Fri, 7 Feb 2020 12:58:47 -0500 Subject: [PATCH] ci: fix build failure on doc only changes (#22075) * ci: fix build failure on doc only changes * ci: fix doc-only check when CI fires on branch before PR is created --- .circleci/config.yml | 4 ++-- script/doc-only-change.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 98cdeccc5de1..fc8279dfd897 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -848,7 +848,7 @@ step-check-for-doc-only-change: &step-check-for-doc-only-change command: | cd src/electron node script/yarn install --frozen-lockfile - if node script/doc-only-change.js --prNumber=$CIRCLE_PR_NUMBER --prURL=$CIRCLE_PULL_REQUEST; then + if node script/doc-only-change.js --prNumber=$CIRCLE_PR_NUMBER --prURL=$CIRCLE_PULL_REQUEST --prBranch=$CIRCLE_BRANCH; then #PR is doc only change; save file with value true to indicate doc only change echo "true" > .skip-ci-build else @@ -884,7 +884,7 @@ step-ts-compile: &step-ts-compile command: | cd src ninja -C out/Default electron:default_app_js -j $NUMBER_OF_NINJA_PROCESSES - ninja -C out/Default electron:atom_js2c -j $NUMBER_OF_NINJA_PROCESSES + ninja -C out/Default electron:electron_js2c -j $NUMBER_OF_NINJA_PROCESSES # Lists of steps. steps-lint: &steps-lint diff --git a/script/doc-only-change.js b/script/doc-only-change.js index a5569dfea883..418e9fb3b06a 100644 --- a/script/doc-only-change.js +++ b/script/doc-only-change.js @@ -9,7 +9,11 @@ async function checkIfDocOnlyChange () { try { let pullRequestNumber = args.prNumber if (!pullRequestNumber || isNaN(pullRequestNumber)) { - if (args.prBranch) { + if (args.prURL) { + // CircleCI doesn't provide the PR number for branch builds, but it does provide the PR URL + const pullRequestParts = args.prURL.split('/') + pullRequestNumber = pullRequestParts[pullRequestParts.length - 1] + } else if (args.prBranch) { // AppVeyor doesn't provide a PR number for branch builds - figure it out from the branch const prsForBranch = await octokit.pulls.list({ owner: 'electron', @@ -23,10 +27,6 @@ async function checkIfDocOnlyChange () { // If there are 0 PRs or more than one PR on a branch, just assume that this is more than a doc change process.exit(1) } - } else if (args.prURL) { - // CircleCI doesn't provide the PR number for branch builds, but it does provide the PR URL - const pullRequestParts = args.prURL.split('/') - pullRequestNumber = pullRequestParts[pullRequestParts.length - 1] } } const filesChanged = await octokit.pulls.listFiles({