Skip to content

Commit e75acb0

Browse files
committed
fixup! fixup! tools: use gh CLI for CI and commit queue jobs
1 parent f4f8836 commit e75acb0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

tools/actions/commit-queue.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ set -xe
44

55
OWNER=$1
66
REPOSITORY=$2
7-
GITHUB_TOKEN=$3
8-
shift 3
7+
shift 2
98

109
UPSTREAM=origin
1110
DEFAULT_BRANCH=master
1211

13-
API_URL=https://api.github.com
12+
COMMIT_QUEUE_LABEL="commit-queue"
13+
COMMIT_QUEUE_FAILED_LABEL="commit-queue-failed"
1414

1515
mergeUrl() {
1616
echo "repos/${OWNER}/${REPOSITORY}/pulls/${1}/merge"
@@ -19,14 +19,14 @@ mergeUrl() {
1919
commit_queue_failed() {
2020
pr=$1
2121

22-
gh pr edit $pr --add-label "${COMMIT_QUEUE_FAILED_LABEL}"
22+
gh pr edit "$pr" --add-label "${COMMIT_QUEUE_FAILED_LABEL}"
2323

2424
# shellcheck disable=SC2154
2525
cqurl="${GITHUB_SERVER_URL}/${OWNER}/${REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
2626
body="<details><summary>Commit Queue failed</summary><pre>$(cat output)</pre><a href='$cqurl'>$cqurl</a></details>"
2727
echo "$body"
2828

29-
gh pr comment $pr --body "$body"
29+
gh pr comment "$pr" --body "$body"
3030

3131
rm output
3232
}
@@ -36,7 +36,7 @@ git config --local user.email "[email protected]"
3636
git config --local user.name "Node.js GitHub Bot"
3737

3838
for pr in "$@"; do
39-
gh pr view $pr --json labels --jq ".labels" > labels.json
39+
gh pr view "$pr" --json labels --jq ".labels" > labels.json
4040
# Skip PR if CI was requested
4141
if jq -e 'map(.name) | index("request-ci")' < labels.json; then
4242
echo "pr ${pr} skipped, waiting for CI to start"
@@ -50,7 +50,7 @@ for pr in "$@"; do
5050
fi
5151

5252
# Delete the commit queue label
53-
gh pr edit $pr --remove-label "$COMMIT_QUEUE_LABEL"
53+
gh pr edit "$pr" --remove-label "$COMMIT_QUEUE_LABEL"
5454

5555
if jq -e 'map(.name) | index("commit-queue-squash")' < labels.json; then
5656
MULTIPLE_COMMIT_POLICY="--fixupAll"

tools/actions/start-ci.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
set -xe
44

5-
REQUEST_CI_LABEL=request-ci
6-
REQUEST_CI_FAILED_LABEL=request-ci-failed
5+
REQUEST_CI_LABEL="request-ci"
6+
REQUEST_CI_FAILED_LABEL="request-ci-failed"
77

88
for pr in "$@"; do
9-
gh pr edit $pr --remove-label "$REQUEST_CI_LABEL"
9+
gh pr edit "$pr" --remove-label "$REQUEST_CI_LABEL"
1010

1111
ci_started=yes
1212
rm -f output;
@@ -15,11 +15,11 @@ for pr in "$@"; do
1515

1616
if [ "$ci_started" = "no" ]; then
1717
# Do we need to reset?
18-
gh pr edit $pr --add-label "$REQUEST_CI_FAILED_LABEL"
18+
gh pr edit "$pr" --add-label "$REQUEST_CI_FAILED_LABEL"
1919

2020
jq -n --arg content "<details><summary>Couldn't start CI</summary><pre>$(cat output)</pre></details>" > output.json
2121

22-
gh pr comment $pr --body-file output.json
22+
gh pr comment "$pr" --body-file output.json
2323

2424
rm output.json;
2525
fi

0 commit comments

Comments
 (0)