From d9f055220d50b96d96adf4950a12e30818f09cbc 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/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 + 9 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml index 7e91c8fd007284..8a3daa705883f8 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 8765d2d8d5cae5..139ecf7c71fbb1 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/linters.yml b/.github/workflows/linters.yml index 06bf14ccc207a7..89371bcb556943 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 108511ba78c28b..b8f403fd7d6a36 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 b66e41273f4a30..7b0c135f0a08c2 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 41f86d85a48855..651152f8cfe678 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 7021ada45ade4d..20fdd7f98764f2 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