Skip to content

Commit 173292b

Browse files
mmarchinitargos
authored andcommitted
build: fix commit-queue default branch
`github.repository.default_branch` is not a valid context variable, and GitHub doesn't have a context or environment variable containing the default branch. It does have `github.ref` and `$GITHUB_REF`, which contains the default branch _reference_ (as in `refs/heads/<branch>`), so we can use that and remove the `refs/heads/` prefix. PR-URL: #38998 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
1 parent be5101e commit 173292b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/workflows/commit-queue.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
run: |
4646
echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV
4747
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
48+
echo "DEFAULT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
4849
4950
- name: Get Pull Requests
5051
uses: octokit/graphql-action@v2.x
@@ -63,19 +64,19 @@ jobs:
6364
owner: ${{ env.OWNER }}
6465
repo: ${{ env.REPOSITORY }}
6566
# Commit queue is only enabled for the default branch on the repository
66-
base_ref: ${{ github.repository.default_branch }}
67+
base_ref: ${{ env.DEFAULT_BRANCH }}
6768
env:
6869
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6970

7071
- name: Configure node-core-utils
7172
run: |
72-
ncu-config set branch ${{ github.repository.default_branch }}
73+
ncu-config set branch ${DEFAULT_BRANCH}
7374
ncu-config set upstream origin
7475
ncu-config set username "${{ secrets.GH_USER_NAME }}"
7576
ncu-config set token "${{ secrets.GH_USER_TOKEN }}"
7677
ncu-config set jenkins_token "${{ secrets.JENKINS_TOKEN }}"
77-
ncu-config set repo "${{ env.REPOSITORY }}"
78-
ncu-config set owner "${{ env.OWNER }}"
78+
ncu-config set repo "${REPOSITORY}"
79+
ncu-config set owner "${OWNER}"
7980
8081
- name: Start the commit queue
81-
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} ${{ secrets.GITHUB_TOKEN }} $(echo '${{ steps.get_mergable_pull_requests.outputs.data }}' | jq '.repository.pullRequests.nodes | map(.number) | .[]')
82+
run: ./tools/actions/commit-queue.sh ${OWNER} ${REPOSITORY} ${{ secrets.GITHUB_TOKEN }} $(echo '${{ steps.get_mergable_pull_requests.outputs.data }}' | jq '.repository.pullRequests.nodes | map(.number) | .[]')

0 commit comments

Comments
 (0)