diff --git a/.github/actions/prose-gate/action.yml b/.github/actions/prose-gate/action.yml index e8f9fbe6..edca233c 100644 --- a/.github/actions/prose-gate/action.yml +++ b/.github/actions/prose-gate/action.yml @@ -23,7 +23,19 @@ runs: # Check the base resolves before scanning, so an empty or absent ref fails naming itself. # Unresolvable, the run would report the repository's whole backlog against this change. # A shallow checkout is the usual cause, so the caller fetches full history. - if ! git rev-parse --verify --quiet "$BASE^{commit}" >/dev/null; then + # A base that is a freshly created merge commit can still lag GitHub's own replication, so retry with backoff before failing rather than treat that lag as a gate failure. + resolved=false + for delay in 0 2 4 8 15 30; do + if [ "$delay" -gt 0 ]; then + sleep "$delay" + git fetch --quiet origin "$BASE" 2>/dev/null || true + fi + if git rev-parse --verify --quiet "$BASE^{commit}" >/dev/null; then + resolved=true + break + fi + done + if ! "$resolved"; then echo "::error::Diff base '$BASE' does not resolve in this checkout." >&2 echo "::error::Check the ref name and that the job checks out with fetch-depth 0." >&2 exit 1