Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
node/.github/workflows/commit-queue.yml at main · javascript-unsafe/node · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
javascript-unsafe
/
node
Public
forked from
nodejs/node
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
main
Breadcrumbs
node
/
.github
/
workflows
/
commit-queue.yml
Copy path
View runs
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
173 lines (154 loc) · 6.25 KB
main
Breadcrumbs
node
/
.github
/
workflows
/
commit-queue.yml
Copy path
Top
File metadata and controls
Code
Blame
173 lines (154 loc) · 6.25 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#
This action requires the following secrets to be set on the repository:
#
GH_USER_TOKEN: GitHub user token, to be used by ncu and to push changes
#
JENKINS_USER: GitHub user whose Jenkins token is defined below
#
JENKINS_TOKEN: Jenkins token, to be used to check CI status
name
:
Commit Queue
on
:
#
`schedule` event is used instead of `pull_request` because when a
#
`pull_request` event is triggered on a PR from a fork, GITHUB_TOKEN will
#
be read-only, and the Action won't have access to any other repository
#
secrets, which it needs to access Jenkins API.
schedule
:
-
cron
:
'
*/5 * * * *
'
concurrency
:
${{ github.workflow }}
env
:
NODE_VERSION
:
lts/*
permissions
:
contents
:
read
jobs
:
get_candidate_prs
:
permissions
:
pull-requests
:
read
if
:
github.repository == 'nodejs/node'
runs-on
:
ubuntu-slim
outputs
:
candidates
:
${{ steps.get_candidate_prs.outputs.candidates }}
steps
:
-
name
:
Get Pull Request Candidates
id
:
get_candidate_prs
run
:
|
list_prs() {
gh pr list \
--repo "$GITHUB_REPOSITORY" \
--base "$GITHUB_REF_NAME" \
--label 'commit-queue' \
"$@" \
--json 'number' \
-t '{{ range . }}{{ .number }} {{ end }}' \
--limit 100
}
aged_prs=$(list_prs \
--search "created:<=$(date --date="2 days ago" +"%Y-%m-%dT%H:%M:%S%z") -label:blocked")
fast_track_prs=$(list_prs \
--label 'fast-track' \
--search "-label:blocked")
candidates=$(printf '%s %s\n' "$fast_track_prs" "$aged_prs" |
jq -r -s 'reduce .[] as $pr ([]; if index($pr) then . else . + [$pr] end) | join(" ")')
echo "candidates=$candidates" >> "$GITHUB_OUTPUT"
env
:
GH_TOKEN
:
${{ github.token }}
commitQueue
:
needs
:
get_candidate_prs
if
:
needs.get_candidate_prs.outputs.candidates != ''
permissions
:
checks
:
read
contents
:
read
pull-requests
:
read
statuses
:
read
runs-on
:
ubuntu-slim
steps
:
-
name
:
Install Node.js
uses
:
actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
#
v6.4.0
with
:
node-version
:
${{ env.NODE_VERSION }}
-
name
:
Install @node-core/utils
run
:
npm install -g @node-core/utils
-
name
:
Configure @node-core/utils
run
:
|
# Keep the config outside the workspace so checkout does not remove it.
ncu-config --global set branch "${GITHUB_REF_NAME}"
ncu-config --global set upstream origin
ncu-config --global set username "$USERNAME"
ncu-config --global set token "$GH_TOKEN"
ncu-config --global set jenkins_token "$JENKINS_TOKEN"
ncu-config --global set repo "${GITHUB_REPOSITORY#*/}"
ncu-config --global set owner "${GITHUB_REPOSITORY_OWNER}"
env
:
USERNAME
:
${{ secrets.JENKINS_USER }}
GH_TOKEN
:
${{ github.token }}
JENKINS_TOKEN
:
${{ secrets.JENKINS_TOKEN }}
-
name
:
Filter Pull Requests
id
:
get_mergeable_prs
run
:
|
readme="${RUNNER_TEMP}/README.md"
curl -fsSLo "$readme" "https://github.com/${GITHUB_REPOSITORY}/raw/${GITHUB_SHA}/README.md"
numbers=
# shellcheck disable=SC2086
for pr in $CANDIDATES; do
metadata="${RUNNER_TEMP}/metadata-${pr}.json"
output="${RUNNER_TEMP}/metadata-${pr}.txt"
if git node metadata "$pr" \
--readme "$readme" \
--json > "$metadata" 2> "$output"; then
metadata_status=0
else
metadata_status=$?
fi
if [ -s "$output" ]; then
cat "$output"
fi
case "$metadata_status" in
0|2[0-9]|4[0-9]) ;;
*)
echo "git node metadata failed for pr ${pr} with exit code ${metadata_status}"
exit 1
;;
esac
metadata_exit_code=$(jq -r '.exitCode' "$metadata") || {
echo "failed to parse metadata JSON for pr ${pr}"
exit 1
}
if [ "$metadata_exit_code" != "$metadata_status" ]; then
echo "metadata JSON exitCode mismatch for pr ${pr}"
exit 1
fi
metadata_reason_codes=$(jq -r '.reasonCodes | join(", ")' "$metadata") || {
echo "failed to parse metadata reason codes for pr ${pr}"
exit 1
}
if [ "$metadata_status" -eq 0 ]; then
echo "pr ${pr} is ready for the commit queue"
numbers="$numbers $pr"
continue
fi
if [ "$metadata_status" -ge 20 ] && [ "$metadata_status" -le 29 ]; then
echo "pr ${pr} skipped, not ready to land"
echo "reason codes: ${metadata_reason_codes}"
continue
fi
echo "pr ${pr} will be handled by the commit queue"
echo "reason codes: ${metadata_reason_codes}"
numbers="$numbers $pr"
done
numbers=$(echo "$numbers" | xargs)
echo "numbers=$numbers" >> "$GITHUB_OUTPUT"
env
:
CANDIDATES
:
${{ needs.get_candidate_prs.outputs.candidates }}
GH_TOKEN
:
${{ github.token }}
-
uses
:
actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
#
v7.0.0
if
:
steps.get_mergeable_prs.outputs.numbers != ''
with
:
#
A personal token is required because pushing with GITHUB_TOKEN will
#
prevent commits from running CI after they land. It needs
#
to be set here because `checkout` configures GitHub authentication
#
for push as well.
token
:
${{ secrets.GH_USER_TOKEN }}
-
name
:
Start the Commit Queue
if
:
steps.get_mergeable_prs.outputs.numbers != ''
run
:
|
git config --local user.email "github-bot@iojs.org"
git config --local user.name "Node.js GitHub Bot"
ncu-config set token "$GH_TOKEN"
./tools/actions/commit-queue.sh ${{ steps.get_mergeable_prs.outputs.numbers }}
env
:
GH_TOKEN
:
${{ secrets.GH_USER_TOKEN }}
You can’t perform that action at this time.