fix(ci): project-sync should not fail when merged PR has no closing keyword#341
Merged
Merged
Conversation
…eyword A merged PR that references issues via "Refs #N" (not "Closes #N") has no closingIssuesReferences — a legitimate non-error outcome. Previously the script could abort with exit 1 under 'set -e' when get_item_id() hit an unexpected GraphQL response shape (e.g. node: null), surfacing as a red 'sync' check on otherwise-green PRs (e.g. PR #338 merge). - Make get_item_id() and the LINKED query python defensive against null/unexpected shapes - Guard the empty-LINKED branch call sites with '|| true' so a missing board item never aborts the job
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When PR #338 was merged, the
sync(project-board) workflow failed with exit 1 — visible as a red check on an otherwise all-green PR.Root cause
PR #338 referenced its issue via
Refs #335(notCloses #335), so itsclosingIssuesReferenceswere empty. That empty case then calledget_item_id()underset -e. When the GraphQL response had an unexpected shape (e.g.node: nullfrom a token/permission quirk), the inline python raisedTypeError, the function returned non-zero, andset -eaborted the script before the intendedexit 0.A merged PR with no closing keyword is a legitimate, non-error outcome — the script treated it as a hard failure.
Fix
get_item_id()and the LINKED query — use.get()chains and fall back to[]so null/unexpected shapes never raise.|| trueso a missing board item can never abort the job.The job is already
continue-on-error: true(non-critical), but this eliminates the spurious red check entirely.Testing
Refs #N→ empty LINKED →get_item_idreturns "" (no throw) → noset_done→exit 0. ✅Closes #N→ LINKED populated → unchanged happy path. ✅Refs #338