diff --git a/scripts/bump.py b/scripts/bump.py index 7827149..0338ef4 100755 --- a/scripts/bump.py +++ b/scripts/bump.py @@ -235,7 +235,7 @@ def run(only=()): if not os.environ.get("DRY"): for k in COOLDOWN_DAYS: sh("gh", "label", "create", f"bump-{k}", "--color", "0e8a16", "--description", f"Automatic {k} update", check=False) - opened = 0 + opened = failed = 0 start = sh("git", "branch", "--show-current").stdout.strip() for slug, cur, rel, k, t, images, version in candidates(only): if k not in COOLDOWN_DAYS or "manual" in t: @@ -272,13 +272,19 @@ def run(only=()): f"Automatic {k} update from the bump bot.\n\n- {old_ref} -> {new_ref}\n- digest `{digest}`") sh("git", "commit", "-q", "-m", f"{title}\n\n{body}") sh("git", "push", "-q", "-f", "origin", branch) - sh("gh", "pr", "create", "--base", "main", "--head", branch, "--title", title, "--body", body, - "--label", f"bump-{k}", check=False) + pr = sh("gh", "pr", "create", "--base", "main", "--head", branch, "--title", title, "--body", body, + "--label", f"bump-{k}", check=False) + if pr.returncode: + failed += 1 + print(f"{slug}: pushed {branch} but could not open the pull request: {pr.stderr.strip()}") + continue opened += 1 print(f"{slug}: opened {title}") if start and not os.environ.get("DRY"): sh("git", "switch", "-q", start, check=False) print(f"{opened} pull requests opened") + if failed: + sys.exit(f"{failed} pull requests could not be opened") # ---- guard -----------------------------------------------------------------------------------