Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/_promotion-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ jobs:
exit 0
fi

# Nothing to promote is a normal state, not a failure. It happens on a
# repo whose `dev` was just cut from `main`, and after any push that
# adds no commit `main` lacks — a sync merge of `main` back into `dev`,
# most often. `gh pr create` answers that with `GraphQL: No commits
# between main and dev` and a non-zero exit, so the job has to ask
# first: comparing the two refs is one API call and says exactly this.
ahead=$(gh api "repos/$GH_REPO/compare/$TARGET...$SOURCE" --jq '.ahead_by')
if [ "$ahead" -eq 0 ]; then
echo "'$SOURCE' carries no commits '$TARGET' lacks — nothing to promote."
exit 0
fi

# `gh pr create` has no --json; it prints the PR URL, whose last
# path segment is the number.
url=$(gh pr create \
Expand Down