Skip to content

Commit d13508d

Browse files
aduh95targos
authored andcommitted
tools: make GH Actions workflows work if default branch is not master
PR-URL: #38516 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Mary Marchini <[email protected]>
1 parent dc67fec commit d13508d

9 files changed

+12
-6
lines changed

.github/workflows/build-tarball.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- main
89
- v[0-9]+.x-staging
910
- v[0-9]+.x
1011

.github/workflows/build-windows.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- main
89
- canary
910
- v[0-9]+.x-staging
1011
- v[0-9]+.x

.github/workflows/commit-queue.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
# See https://github.com./nodejs/node-core-utils/pull/486
2929
fetch-depth: 0
3030
# A personal token is required because pushing with GITHUB_TOKEN will
31-
# prevent commits from running CI after they land on master. It needs
31+
# prevent commits from running CI after they land. It needs
3232
# to be set here because `checkout` configures GitHub authentication
3333
# for push as well.
3434
token: ${{ secrets.GH_USER_TOKEN }}
@@ -63,15 +63,13 @@ jobs:
6363
owner: ${{ env.OWNER }}
6464
repo: ${{ env.REPOSITORY }}
6565
# Commit queue is only enabled for the default branch on the repository
66-
# TODO(mmarchini): get the default branch programmatically instead of
67-
# assuming `master`
68-
base_ref: "master"
66+
base_ref: ${{ github.repository.default_branch }}
6967
env:
7068
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7169

7270
- name: Configure node-core-utils
7371
run: |
74-
ncu-config set branch master
72+
ncu-config set branch ${{ github.repository.default_branch }}
7573
ncu-config set upstream origin
7674
ncu-config set username "${{ secrets.GH_USER_NAME }}"
7775
ncu-config set token "${{ secrets.GH_USER_TOKEN }}"

.github/workflows/linters.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- main
89
- v[0-9]+.x-staging
910
- v[0-9]+.x
1011

.github/workflows/misc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- main
89
- v[0-9]+.x-staging
910
- v[0-9]+.x
1011

.github/workflows/notify-force-push.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ on:
22
push:
33
branches:
44
- master
5+
- main
56

67
name: Notify on Force Push
78
jobs:
@@ -17,7 +18,7 @@ jobs:
1718
SLACK_ICON: https://github.com./nodejs.png?size=48
1819
SLACK_TITLE: '${{ github.actor }} force-pushed to ${{ github.ref }}'
1920
SLACK_MESSAGE: |
20-
A commit was force-pushed to <https://github.com./${{ github.repository }}/tree/master|${{ github.repository }}@master> by <https://github.com./${{ github.actor }}|${{ github.actor }}>
21+
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 }}>
2122
2223
Before: <https://github.com./${{ github.repository }}/commit/${{ github.event.before }}|${{ github.event.before }}>
2324
After: <https://github.com./${{ github.repository }}/commit/${{ github.event.after }}|${{ github.event.after }}>

.github/workflows/test-asan.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- master
7+
- main
78
- canary
89
- v[0-9]+.x-staging
910
- v[0-9]+.x

.github/workflows/test-linux.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- main
89
- canary
910
- v[0-9]+.x-staging
1011
- v[0-9]+.x

.github/workflows/test-macos.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- master
10+
- main
1011
- canary
1112
- v[0-9]+.x-staging
1213
- v[0-9]+.x

0 commit comments

Comments
 (0)