From b0341512b840ba0ada0194a8da4228edffbfe5e8 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 3 May 2021 10:59:10 +0200 Subject: [PATCH] tools: make GH Actions workflows work if default branch is not master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/38516 Reviewed-By: Michaƫl Zasso Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Darshan Sen Reviewed-By: Mary Marchini --- .github/workflows/build-tarball.yml | 1 + .github/workflows/build-windows.yml | 1 + .github/workflows/commit-queue.yml | 8 +++----- .github/workflows/coverage-linux.yml | 1 + .github/workflows/coverage-windows.yml | 1 + .github/workflows/linters.yml | 1 + .github/workflows/misc.yml | 1 + .github/workflows/notify-force-push.yml | 3 ++- .github/workflows/test-asan.yml | 1 + .github/workflows/test-linux.yml | 1 + .github/workflows/test-macos.yml | 1 + 11 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml index 226dc69f0e921b..1f802ca12b56c6 100644 --- a/.github/workflows/build-tarball.yml +++ b/.github/workflows/build-tarball.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - main - v[0-9]+.x-staging - v[0-9]+.x diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index d3e1e4339245af..dea275876eacb3 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - main - canary - v[0-9]+.x-staging - v[0-9]+.x diff --git a/.github/workflows/commit-queue.yml b/.github/workflows/commit-queue.yml index 5b36a358c61533..50d729aab55930 100644 --- a/.github/workflows/commit-queue.yml +++ b/.github/workflows/commit-queue.yml @@ -28,7 +28,7 @@ jobs: # See https://github.com/nodejs/node-core-utils/pull/486 fetch-depth: 0 # A personal token is required because pushing with GITHUB_TOKEN will - # prevent commits from running CI after they land on master. It needs + # prevent commits from running CI after they land. It needs # to be set here because `checkout` configures GitHub authentication # for push as well. token: ${{ secrets.GH_USER_TOKEN }} @@ -63,15 +63,13 @@ jobs: owner: ${{ env.OWNER }} repo: ${{ env.REPOSITORY }} # Commit queue is only enabled for the default branch on the repository - # TODO(mmarchini): get the default branch programmatically instead of - # assuming `master` - base_ref: "master" + base_ref: ${{ github.repository.default_branch }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Configure node-core-utils run: | - ncu-config set branch master + ncu-config set branch ${{ github.repository.default_branch }} ncu-config set upstream origin ncu-config set username "${{ secrets.GH_USER_NAME }}" ncu-config set token "${{ secrets.GH_USER_TOKEN }}" diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml index 75f296230dfd37..62881f63724f1d 100644 --- a/.github/workflows/coverage-linux.yml +++ b/.github/workflows/coverage-linux.yml @@ -10,6 +10,7 @@ on: push: branches: - master + - main paths-ignore: - 'doc/**' - 'deps/**' diff --git a/.github/workflows/coverage-windows.yml b/.github/workflows/coverage-windows.yml index ac809f3f0be4a3..5387688e3c246a 100644 --- a/.github/workflows/coverage-windows.yml +++ b/.github/workflows/coverage-windows.yml @@ -10,6 +10,7 @@ on: push: branches: - master + - main paths-ignore: - 'doc/**' - 'deps/**' diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 1b0f8c868db25f..1fdcd6059bb2ad 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - main - v[0-9]+.x-staging - v[0-9]+.x diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml index 83c65225f0ac40..6167af045f0543 100644 --- a/.github/workflows/misc.yml +++ b/.github/workflows/misc.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - main - v[0-9]+.x-staging - v[0-9]+.x diff --git a/.github/workflows/notify-force-push.yml b/.github/workflows/notify-force-push.yml index 079141bba2a8d8..e3bdc0353c60fb 100644 --- a/.github/workflows/notify-force-push.yml +++ b/.github/workflows/notify-force-push.yml @@ -2,6 +2,7 @@ on: push: branches: - master + - main name: Notify on Force Push jobs: @@ -17,7 +18,7 @@ jobs: SLACK_ICON: https://github.com/nodejs.png?size=48 SLACK_TITLE: '${{ github.actor }} force-pushed to ${{ github.ref }}' SLACK_MESSAGE: | - A commit was force-pushed to by + A commit was force-pushed to by Before: After: diff --git a/.github/workflows/test-asan.yml b/.github/workflows/test-asan.yml index 9e6192c32a37e9..d6dd1b7b7ec83f 100644 --- a/.github/workflows/test-asan.yml +++ b/.github/workflows/test-asan.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - main - canary - v[0-9]+.x-staging - v[0-9]+.x diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 41968139816c38..b191deb806ee1a 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - main - canary - v[0-9]+.x-staging - v[0-9]+.x diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 5f516608c267e4..725a3e4a8c9a26 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -7,6 +7,7 @@ on: push: branches: - master + - main - canary - v[0-9]+.x-staging - v[0-9]+.x