Skip to content

Commit

Permalink
tools: make GH Actions workflows work if default branch is not master
Browse files Browse the repository at this point in the history
PR-URL: #38516
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
  • Loading branch information
aduh95 authored and targos committed Jun 11, 2021
1 parent dc67fec commit d13508d
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-tarball.yml
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-windows.yml
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/commit-queue.yml
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linters.yml
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/misc.yml
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/notify-force-push.yml
Expand Up @@ -2,6 +2,7 @@ on:
push:
branches:
- master
- main

name: Notify on Force Push
jobs:
Expand All @@ -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 <https://github.com/${{ github.repository }}/tree/master|${{ github.repository }}@master> by <https://github.com/${{ github.actor }}|${{ github.actor }}>
A commit was force-pushed to <https://github.com/${{ github.repository }}/tree/${{ github.repository.default_branch }}|${{ github.repository }}@${{ github.repository.default_branch }}> by <https://github.com/${{ github.actor }}|${{ github.actor }}>
Before: <https://github.com/${{ github.repository }}/commit/${{ github.event.before }}|${{ github.event.before }}>
After: <https://github.com/${{ github.repository }}/commit/${{ github.event.after }}|${{ github.event.after }}>
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-asan.yml
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-linux.yml
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-macos.yml
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down

0 comments on commit d13508d

Please sign in to comment.