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 committed 2020-12-16 23:45:26 +01:00
1 parent 4a6200e289
commit 0e96dc1f95
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
+5 -5
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -xe
@@ -10,15 +10,15 @@ REQUEST_CI_LABEL='request-ci'
REQUEST_CI_FAILED_LABEL='request-ci-failed'
shift 3
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"
}
@@ -33,7 +33,7 @@ for pr in "$@"; do
ncu-ci run "$pr" >output 2>&1 || ci_started=no
cat output
if [ "$ci_started" == "no" ]; then
if [ "$ci_started" = "no" ]; then
# Do we need to reset?
curl -sL --request PUT \
--url "$(labelsUrl "$pr")" \