Skip to content

fix(promotion-pr): treat nothing to promote as success - #30

Merged
TitusKirch merged 1 commit into
devfrom
fix/promotion-pr-nothing-to-promote
Sep 5, 2026
Merged

fix(promotion-pr): treat nothing to promote as success#30
TitusKirch merged 1 commit into
devfrom
fix/promotion-pr-nothing-to-promote

Conversation

@TitusKirch

Copy link
Copy Markdown
Member

Gefunden an kirchDev/duxt: dort schlug jeder Push auf dev im Promotion-PR-Workflow fehl.

Was passiert

gh pr create beantwortet den Fall „Quelle enthält nichts, was das Ziel nicht hat" mit

pull request create failed: GraphQL: No commits between main and dev

und einem Exit-Code ungleich 0. Der Job wird also rot — obwohl nichts falsch ist.

Das ist ein normaler Zustand, kein Fehler:

  • ein frisch angelegtes Repo, dessen dev gerade von main geschnitten wurde (genau duxt),
  • jeder Push, der keinen Commit hinzufügt, den main nicht schon hat — typischerweise ein Sync-Merge von main zurück nach dev.

Der Fix

Ein compare-Aufruf beantwortet die Frage, bevor create es versucht:

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

Der Output pull-request-number ist bereits als „empty if none was needed" dokumentiert — der frühe Ausstieg braucht also keine Signaturänderung.

Reichweite

Der Body wird von 20 Repos aufgerufen. Bisher ist es nur an duxt aufgefallen, weil dort dev == main der Dauerzustand war; die anderen treffen es nach jedem Sync-Merge.

`gh pr create` answers `GraphQL: No commits between main and dev` with a
non-zero exit, so the job went red whenever the source branch carried nothing
the target lacks. That is a normal state, not a failure: it holds on a repo
whose `dev` was just cut from `main`, and after any push adding no new commit —
a sync merge of `main` back into `dev`, most often.

Found on kirchDev/duxt, freshly created, where every push to `dev` failed the
Promotion PR workflow. The body is called by 20 repos, so each of them meets it
sooner or later.

One compare call answers it before the create is attempted. The job's
`pull-request-number` output is already documented as empty when no PR was
needed, so the early exit needs no signature change.
@TitusKirch
TitusKirch merged commit 3c77eb0 into dev Sep 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant