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;
|
|
|
|
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"
|
|
|
|
|
2021-12-25 03:25:06 +08:00
|
|
|
jq -n --arg content "<details><summary>Couldn't start CI</summary><pre>$(cat output || true)</pre></details>" > output.json
|
2021-11-07 22:26:45 +08:00
|
|
|
|
|
|
|
gh pr comment "$pr" --body-file output.json
|
2020-06-28 03:38:02 +08:00
|
|
|
|
|
|
|
rm output.json;
|
|
|
|
fi
|
|
|
|
done;
|