test_dep_update: exit gracefully if no pending PRs

This commit is contained in:
André Silva
2022-05-29 20:09:51 +01:00
committed by ckie
parent e0189af753
commit a7a360c6dc

View File

@ -7,6 +7,12 @@ git branch depupdate
git checkout depupdate git checkout depupdate
git reset --hard origin/master git reset --hard origin/master
json="$(gh pr list --search "author:app/github-actions" --json headRefName,number)" json="$(gh pr list --search "author:app/github-actions" --json headRefName,number)"
# If there's no updates then the CI action will fail without this, which is more common if we reduce the schedule from 24 hours.
if [[ $json == "[]" ]]; then
echo "No Dependency update PRs to merge"
exit
fi
echo "$json" | jq '.[] | .headRefName | @text' | xargs -L1 -- git pull origin echo "$json" | jq '.[] | .headRefName | @text' | xargs -L1 -- git pull origin
if nix build .#checks.x86_64-linux.init-example-el; then if nix build .#checks.x86_64-linux.init-example-el; then
echo "$json" | jq ".[] | .number | @text" | xargs -L1 -- gh pr merge --squash --delete-branch echo "$json" | jq ".[] | .number | @text" | xargs -L1 -- gh pr merge --squash --delete-branch