2020-11-11 07:26:07 +08:00
|
|
|
#!/bin/sh
|
2020-06-28 03:38:02 +08:00
|
|
|
|
|
|
|
set -xe
|
|
|
|
|
2021-11-07 22:26:45 +08:00
|
|
|
REQUEST_CI_LABEL="request-ci"
|
|
|
|
REQUEST_CI_FAILED_LABEL="request-ci-failed"
|
2020-06-28 03:38:02 +08:00
|
|
|
|
|
|
|
for pr in "$@"; do
|
2021-11-07 22:26:45 +08:00
|
|
|
gh pr edit "$pr" --remove-label "$REQUEST_CI_LABEL"
|
2020-06-28 03:38:02 +08:00
|
|
|
|
|
|
|
ci_started=yes
|
|
|
|
rm -f output;
|
2024-05-24 17:47:50 +08:00
|
|
|
ncu-ci run "$pr" >output 2>&1 || ci_started=no
|
2020-08-05 23:03:22 +08:00
|
|
|
cat output
|
2020-06-28 03:38:02 +08:00
|
|
|
|
2020-11-11 07:26:07 +08:00
|
|
|
if [ "$ci_started" = "no" ]; then
|
2020-06-28 03:38:02 +08:00
|
|
|
# Do we need to reset?
|
2021-11-07 22:26:45 +08:00
|
|
|
gh pr edit "$pr" --add-label "$REQUEST_CI_FAILED_LABEL"
|
|
|
|
|
2022-10-28 19:45:35 +08:00
|
|
|
# shellcheck disable=SC2154
|
2022-11-03 10:14:40 +08:00
|
|
|
cqurl="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|
2022-10-28 19:45:35 +08:00
|
|
|
body="<details><summary>Failed to start CI</summary><pre>$(cat output)</pre><a href='$cqurl'>$cqurl</a></details>"
|
|
|
|
echo "$body"
|
2021-11-07 22:26:45 +08:00
|
|
|
|
2022-10-28 19:45:35 +08:00
|
|
|
gh pr comment "$pr" --body "$body"
|
2020-06-28 03:38:02 +08:00
|
|
|
|
2022-10-28 19:45:35 +08:00
|
|
|
rm output
|
2020-06-28 03:38:02 +08:00
|
|
|
fi
|
|
|
|
done;
|