mirror of
https://github.com/lupyuen/nuttx-release.git
synced 2025-01-12 23:28:30 +08:00
Skip if jobs are still running
This commit is contained in:
parent
76d312c2ef
commit
8f1a14bcf4
1 changed files with 31 additions and 4 deletions
|
@ -6,10 +6,36 @@ for (( ; ; )); do
|
|||
nuttxpr/nuttx \
|
||||
nuttxpr/nuttx-apps
|
||||
do
|
||||
## Find the latest failed job for today
|
||||
## Find the running jobs for today
|
||||
echo repo=$repo
|
||||
date=$(date -u +'%Y-%m-%d')
|
||||
run_list="
|
||||
running_list="
|
||||
$(gh run list \
|
||||
--repo $repo \
|
||||
--limit 1 \
|
||||
--created $date \
|
||||
--status queued \
|
||||
--json databaseId,name,displayTitle,conclusion \
|
||||
--jq '.[].databaseId')
|
||||
$(gh run list \
|
||||
--repo $repo \
|
||||
--limit 1 \
|
||||
--created $date \
|
||||
--status in_progress \
|
||||
--json databaseId,name,displayTitle,conclusion \
|
||||
--jq '.[].databaseId')
|
||||
"
|
||||
running_list=$(echo $running_list | xargs)
|
||||
echo running_list=$running_list
|
||||
|
||||
## Skip if jobs are still running
|
||||
if [[ "$running_list" != "" ]]; then
|
||||
echo Skipping $repo, jobs are still running
|
||||
continue
|
||||
fi
|
||||
|
||||
## Find the latest failed job for today
|
||||
failed_list="
|
||||
$(gh run list \
|
||||
--repo $repo \
|
||||
--limit 1 \
|
||||
|
@ -18,9 +44,10 @@ for (( ; ; )); do
|
|||
--json databaseId,name,displayTitle,conclusion \
|
||||
--jq '.[].databaseId')
|
||||
"
|
||||
|
||||
## Restart the failed job
|
||||
echo run_list=$run_list
|
||||
for run_id in $run_list; do
|
||||
echo failed_list=$failed_list
|
||||
for run_id in $failed_list; do
|
||||
echo Restarting $run_id
|
||||
gh run rerun --repo $repo --debug --failed $run_id
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue