From fb0853e161c65e3e83dbb73fe79969e85a79c870 Mon Sep 17 00:00:00 2001 From: "Anaz S. Aji" Date: Thu, 16 Jul 2026 08:02:15 +0700 Subject: [PATCH] fix(ci): project-sync should not fail when merged PR has no closing keyword MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/workflows/project-sync.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/project-sync.yml b/.github/workflows/project-sync.yml index c081110..576e357 100644 --- a/.github/workflows/project-sync.yml +++ b/.github/workflows/project-sync.yml @@ -121,8 +121,10 @@ jobs: | python3 -c " import sys, json data = json.load(sys.stdin) + node = (data.get('data') or {}).get('node') or {} + items = (node.get('items') or {}).get('nodes') or [] target = '$content_node_id' - for n in data['data']['node']['items']['nodes']: + for n in items: c = n.get('content') or {} if c.get('id') == target: print(n['id']) @@ -176,17 +178,21 @@ jobs: | python3 -c " import sys, json data = json.load(sys.stdin) - nodes = data['data']['node']['closingIssuesReferences']['nodes'] + node = (data.get('data') or {}).get('node') or {} + nodes = (node.get('closingIssuesReferences') or {}).get('nodes') or [] for n in nodes: print(n['id'] + ' ' + str(n['number'])) " 2>/dev/null || true) if [ -z "$LINKED" ]; then echo "No linked closing issues found for PR #$PR_NUMBER." - # If the PR content itself is on the board, mark it Done. - item_id=$(get_item_id "$PR_NODE_ID") + # A merged PR that references issues via "Refs #N" (rather than + # a closing keyword) legitimately has no closing references — + # this is not an error. Best-effort: mark the PR itself Done if + # it happens to be on the board. + item_id=$(get_item_id "$PR_NODE_ID" || true) if [ -n "$item_id" ]; then - set_done "$item_id" + set_done "$item_id" || true fi else echo "$LINKED" | while read -r issue_node issue_num; do