-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! fixup! tools: use gh CLI for CI and commit queue jobs
- Loading branch information
Showing
2 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,13 @@ set -xe | |
|
||
OWNER=$1 | ||
REPOSITORY=$2 | ||
GITHUB_TOKEN=$3 | ||
shift 3 | ||
shift 2 | ||
|
||
UPSTREAM=origin | ||
DEFAULT_BRANCH=master | ||
|
||
API_URL=https://api.github.com | ||
COMMIT_QUEUE_LABEL="commit-queue" | ||
COMMIT_QUEUE_FAILED_LABEL="commit-queue-failed" | ||
|
||
mergeUrl() { | ||
echo "repos/${OWNER}/${REPOSITORY}/pulls/${1}/merge" | ||
|
@@ -19,14 +19,14 @@ mergeUrl() { | |
commit_queue_failed() { | ||
pr=$1 | ||
|
||
gh pr edit $pr --add-label "${COMMIT_QUEUE_FAILED_LABEL}" | ||
gh pr edit "$pr" --add-label "${COMMIT_QUEUE_FAILED_LABEL}" | ||
|
||
# shellcheck disable=SC2154 | ||
cqurl="${GITHUB_SERVER_URL}/${OWNER}/${REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" | ||
body="<details><summary>Commit Queue failed</summary><pre>$(cat output)</pre><a href='$cqurl'>$cqurl</a></details>" | ||
echo "$body" | ||
|
||
gh pr comment $pr --body "$body" | ||
gh pr comment "$pr" --body "$body" | ||
|
||
rm output | ||
} | ||
|
@@ -36,7 +36,7 @@ git config --local user.email "[email protected]" | |
git config --local user.name "Node.js GitHub Bot" | ||
|
||
for pr in "$@"; do | ||
gh pr view $pr --json labels --jq ".labels" > labels.json | ||
gh pr view "$pr" --json labels --jq ".labels" > labels.json | ||
# Skip PR if CI was requested | ||
if jq -e 'map(.name) | index("request-ci")' < labels.json; then | ||
echo "pr ${pr} skipped, waiting for CI to start" | ||
|
@@ -50,7 +50,7 @@ for pr in "$@"; do | |
fi | ||
|
||
# Delete the commit queue label | ||
gh pr edit $pr --remove-label "$COMMIT_QUEUE_LABEL" | ||
gh pr edit "$pr" --remove-label "$COMMIT_QUEUE_LABEL" | ||
|
||
if jq -e 'map(.name) | index("commit-queue-squash")' < labels.json; then | ||
MULTIPLE_COMMIT_POLICY="--fixupAll" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters