1
1
# 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
3
2
# 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
4
4
# JENKINS_TOKEN: Jenkins token, to be used to check CI status
5
5
6
6
name : Commit Queue
25
25
get_mergeable_prs :
26
26
permissions :
27
27
pull-requests : read
28
- if : github.repository == 'nodejs/node'
28
+ if : github.repository == 'nodejs/node-auto-test '
29
29
runs-on : ubuntu-latest
30
30
outputs :
31
31
numbers : ${{ steps.get_mergeable_prs.outputs.numbers }}
@@ -34,41 +34,41 @@ jobs:
34
34
id : get_mergeable_prs
35
35
run : |
36
36
prs=$(gh pr list \
37
- --repo ${{ github.repository }} \
38
- --base ${{ github.ref_name }} \
37
+ --repo "$GITHUB_REPOSITORY" \
38
+ --base "$GITHUB_REF_NAME" \
39
39
--label 'commit-queue' \
40
40
--json 'number' \
41
41
--search "created:<=$(date --date="2 days ago" +"%Y-%m-%dT%H:%M:%S%z") -label:blocked" \
42
42
-t '{{ range . }}{{ .number }} {{ end }}' \
43
43
--limit 100)
44
44
fast_track_prs=$(gh pr list \
45
- --repo ${{ github.repository }} \
46
- --base ${{ github.ref_name }} \
45
+ --repo "$GITHUB_REPOSITORY" \
46
+ --base "$GITHUB_REF_NAME" \
47
47
--label 'commit-queue' \
48
48
--label 'fast-track' \
49
49
--search "-label:blocked" \
50
50
--json 'number' \
51
51
-t '{{ range . }}{{ .number }} {{ end }}' \
52
52
--limit 100)
53
53
numbers=$(echo $prs' '$fast_track_prs | jq -r -s 'unique | join(" ")')
54
- echo "numbers=$numbers" >> $GITHUB_OUTPUT
54
+ echo "numbers=$numbers" >> " $GITHUB_OUTPUT"
55
55
env :
56
56
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57
57
commitQueue :
58
58
needs : get_mergeable_prs
59
59
if : needs.get_mergeable_prs.outputs.numbers != ''
60
+ permissions :
61
+ contents : write
62
+ pull-requests : write
60
63
runs-on : ubuntu-latest
61
64
steps :
62
65
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
63
66
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
67
67
# A personal token is required because pushing with GITHUB_TOKEN will
68
68
# prevent commits from running CI after they land. It needs
69
69
# to be set here because `checkout` configures GitHub authentication
70
70
# for push as well.
71
- token : ${{ secrets.GH_USER_TOKEN }}
71
+ token : ${{ secrets.GITHUB_TOKEN }}
72
72
73
73
# Install dependencies
74
74
- name : Install Node.js
@@ -80,24 +80,23 @@ jobs:
80
80
81
81
- name : Set variables
82
82
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"
85
84
86
85
- name : Configure @node-core/utils
87
86
run : |
88
- ncu-config set branch ${GITHUB_REF_NAME}
87
+ ncu-config set branch " ${GITHUB_REF_NAME}"
89
88
ncu-config set upstream origin
90
89
ncu-config set username "$USERNAME"
91
- ncu-config set token "$GH_TOKEN "
90
+ ncu-config set token "$GITHUB_TOKEN "
92
91
ncu-config set jenkins_token "$JENKINS_TOKEN"
93
92
ncu-config set repo "${REPOSITORY}"
94
- ncu-config set owner "${OWNER }"
93
+ ncu-config set owner "${GITHUB_REPOSITORY_OWNER }"
95
94
env :
96
95
USERNAME : ${{ secrets.JENKINS_USER }}
97
- GH_TOKEN : ${{ secrets.GH_USER_TOKEN }}
96
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98
97
JENKINS_TOKEN : ${{ secrets.JENKINS_TOKEN }}
99
98
100
99
- 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 }}
102
101
env :
103
- GITHUB_TOKEN : ${{ secrets.GH_USER_TOKEN }}
102
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments