Skip to content

Commit f15bbc9

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

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

.github/workflows/commit-queue.yml

Lines changed: 18 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,41 @@ 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
62+
pull-requests: write
6063
runs-on: ubuntu-latest
6164
steps:
6265
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6366
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
6767
# A personal token is required because pushing with GITHUB_TOKEN will
6868
# prevent commits from running CI after they land. It needs
6969
# to be set here because `checkout` configures GitHub authentication
7070
# for push as well.
71-
token: ${{ secrets.GH_USER_TOKEN }}
71+
token: ${{ secrets.GITHUB_TOKEN }}
7272

7373
# Install dependencies
7474
- name: Install Node.js
@@ -80,24 +80,23 @@ jobs:
8080

8181
- name: Set variables
8282
run: |
83-
echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV
84-
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
83+
echo "REPOSITORY=$(echo "$GITHUB_REPOSITORY" | cut -d/ -f2)" >> "$GITHUB_ENV"
8584
8685
- name: Configure @node-core/utils
8786
run: |
88-
ncu-config set branch ${GITHUB_REF_NAME}
87+
ncu-config set branch "${GITHUB_REF_NAME}"
8988
ncu-config set upstream origin
9089
ncu-config set username "$USERNAME"
91-
ncu-config set token "$GH_TOKEN"
90+
ncu-config set token "$GITHUB_TOKEN"
9291
ncu-config set jenkins_token "$JENKINS_TOKEN"
9392
ncu-config set repo "${REPOSITORY}"
94-
ncu-config set owner "${OWNER}"
93+
ncu-config set owner "${GITHUB_REPOSITORY_OWNER}"
9594
env:
9695
USERNAME: ${{ secrets.JENKINS_USER }}
97-
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }}
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9897
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
9998

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

0 commit comments

Comments
 (0)