tools: lint shell scripts

PR-URL: https://github.com/nodejs/node/pull/36099
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Antoine du Hamel authored and Michaël Zasso committed 2020-12-21 18:24:26 +01:00
1 parent eb29a16bae
commit 7b8d373d5e
12 files changed
+255 -54

No files matched your search

+6 -5
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -xe
@@ -14,19 +14,19 @@ API_URL=https://api.github.com
COMMIT_QUEUE_LABEL='commit-queue'
COMMIT_QUEUE_FAILED_LABEL='commit-queue-failed'
function issueUrl() {
issueUrl() {
echo "$API_URL/repos/${OWNER}/${REPOSITORY}/issues/${1}"
}
function labelsUrl() {
labelsUrl() {
echo "$(issueUrl "${1}")/labels"
}
function commentsUrl() {
commentsUrl() {
echo "$(issueUrl "${1}")/comments"
}
function gitHubCurl() {
gitHubCurl() {
url=$1
method=$2
shift 2
@@ -67,6 +67,7 @@ for pr in "$@"; do
if ! tail -n 10 output | grep '. Post "Landed in .*/pull/'"${pr}"; then
gitHubCurl "$(labelsUrl "$pr")" POST --data '{"labels": ["'"${COMMIT_QUEUE_FAILED_LABEL}"'"]}'
# shellcheck disable=SC2154
cqurl="${GITHUB_SERVER_URL}/${OWNER}/${REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
jq -n --arg content "<details><summary>Commit Queue failed</summary><pre>$(cat output)</pre><a href='$cqurl'>$cqurl</a></details>" '{body: $content}' > output.json
cat output.json