Skip to content

Commit cb5f705

Browse files
committed
tools: edit commit-queue workflow file
PR-URL: nodejs-private/node-private#1
1 parent 5f7dbf4 commit cb5f705

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

.github/workflows/commit-queue.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This action requires the following secrets to be set on the repository:
2-
# GH_USER_NAME: GitHub user whose Jenkins and GitHub token are defined below
32
# GH_USER_TOKEN: GitHub user token, to be used by ncu and to push changes
3+
# JENKINS_USER: GitHub user whose Jenkins token is defined below
44
# JENKINS_TOKEN: Jenkins token, to be used to check CI status
55

66
name: Commit Queue
@@ -25,7 +25,7 @@ jobs:
2525
get_mergeable_prs:
2626
permissions:
2727
pull-requests: read
28-
if: github.repository == 'nodejs/node'
28+
if: github.repository == 'nodejs/node-auto-test'
2929
runs-on: ubuntu-latest
3030
outputs:
3131
numbers: ${{ steps.get_mergeable_prs.outputs.numbers }}
@@ -34,41 +34,40 @@ jobs:
3434
id: get_mergeable_prs
3535
run: |
3636
prs=$(gh pr list \
37-
--repo ${{ github.repository }} \
38-
--base ${{ github.ref_name }} \
37+
--repo "$GITHUB_REPOSITORY" \
38+
--base "$GITHUB_REF_NAME" \
3939
--label 'commit-queue' \
4040
--json 'number' \
4141
--search "created:<=$(date --date="2 days ago" +"%Y-%m-%dT%H:%M:%S%z") -label:blocked" \
4242
-t '{{ range . }}{{ .number }} {{ end }}' \
4343
--limit 100)
4444
fast_track_prs=$(gh pr list \
45-
--repo ${{ github.repository }} \
46-
--base ${{ github.ref_name }} \
45+
--repo "$GITHUB_REPOSITORY" \
46+
--base "$GITHUB_REF_NAME" \
4747
--label 'commit-queue' \
4848
--label 'fast-track' \
4949
--search "-label:blocked" \
5050
--json 'number' \
5151
-t '{{ range . }}{{ .number }} {{ end }}' \
5252
--limit 100)
5353
numbers=$(echo $prs' '$fast_track_prs | jq -r -s 'unique | join(" ")')
54-
echo "numbers=$numbers" >> $GITHUB_OUTPUT
54+
echo "numbers=$numbers" >> "$GITHUB_OUTPUT"
5555
env:
5656
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5757
commitQueue:
5858
needs: get_mergeable_prs
5959
if: needs.get_mergeable_prs.outputs.numbers != ''
60+
permissions:
61+
contents: write
6062
runs-on: ubuntu-latest
6163
steps:
6264
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6365
with:
64-
# Needs the whole git history for ncu to work
65-
# See https://github.com/nodejs/node-core-utils/pull/486
66-
fetch-depth: 0
6766
# A personal token is required because pushing with GITHUB_TOKEN will
6867
# prevent commits from running CI after they land. It needs
6968
# to be set here because `checkout` configures GitHub authentication
7069
# for push as well.
71-
token: ${{ secrets.GH_USER_TOKEN }}
70+
token: ${{ secrets.GITHUB_TOKEN }}
7271

7372
# Install dependencies
7473
- name: Install Node.js
@@ -80,24 +79,23 @@ jobs:
8079

8180
- name: Set variables
8281
run: |
83-
echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV
84-
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
82+
echo "REPOSITORY=$(echo "$GITHUB_REPOSITORY" | cut -d/ -f2)" >> "$GITHUB_ENV"
8583
8684
- name: Configure @node-core/utils
8785
run: |
88-
ncu-config set branch ${GITHUB_REF_NAME}
86+
ncu-config set branch "${GITHUB_REF_NAME}"
8987
ncu-config set upstream origin
9088
ncu-config set username "$USERNAME"
91-
ncu-config set token "$GH_TOKEN"
89+
ncu-config set token "$GITHUB_TOKEN"
9290
ncu-config set jenkins_token "$JENKINS_TOKEN"
9391
ncu-config set repo "${REPOSITORY}"
94-
ncu-config set owner "${OWNER}"
92+
ncu-config set owner "${GITHUB_REPOSITORY_OWNER}"
9593
env:
9694
USERNAME: ${{ secrets.JENKINS_USER }}
97-
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }}
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9896
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
9997

10098
- name: Start the Commit Queue
101-
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} ${{ needs.get_mergeable_prs.outputs.numbers }}
99+
run: ./tools/actions/commit-queue.sh "${GITHUB_REPOSITORY_OWNER}" "${REPOSITORY}" ${{ needs.get_mergeable_prs.outputs.numbers }}
102100
env:
103-
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)