Repository navigation
fix(ci): archive triage board cards when issues close - #1287
Conversation
The triage project sync only added/updated cards on label changes; it never removed them when an issue closed, so the Auto-Triage board accumulated closed issues indefinitely. Add `closed` and `reopened` to the issues trigger. The sync now keys the add-vs-remove decision on the issue's open/closed state: closing archives the card (reversible, leaves active board views, kept in the project archive); reopening unarchives and re-syncs it from labels. Because addProjectV2ItemById returns an existing item as-is, the upsert path unarchives explicitly so a reopened card returns to the active board. Handling state in the main loop (not only on the `closed` event) means label edits on already-closed issues and the manual backfill reconcile too, so the board self-heals to "open triaged issues only". Card lookup matches on the project node id, not the per-owner project number, so a foreign project that also happens to be #3 can't be targeted. The backfill loop is per-issue try/catch so one failure does not abort the batch; single-issue runs still fail loudly.
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 852e13b | Jun 02 2026, 12:33 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 852e13b | Jun 02 2026, 12:34 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | 852e13b | Jun 02 2026, 12:34 PM |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
Pull request overview
Updates the triage-project-sync GitHub Actions workflow so the Auto-Triage Projects v2 board stays consistent with issue lifecycle by archiving cards when issues close and restoring them when issues reopen.
Changes:
- Expands the
issuestrigger to includeclosedandreopened. - Adds logic to archive the project card for closed issues and explicitly unarchive cards when re-adding/upserting reopened issues.
- Improves safety/resilience with project-item matching by project node ID and per-issue error handling during
workflow_dispatchbackfills.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // here -- rather than only on the `closed` event -- means label | ||
| // changes on an already-closed issue, and the dispatch backfill, | ||
| // also reconcile, so the board self-heals to "open triaged | ||
| // issues only". Reopening hits the else-branch with state "open" | ||
| // and is re-added below if it still carries triage labels. |
| } catch (e) { | ||
| failures++; | ||
| core.warning(`#${iss.number}: sync failed: ${e.message}`); |
There was a problem hiding this comment.
This PR is a focused, well-scrubbed fix to the triage-project-sync workflow. The approach is sound: instead of letting closed issues linger on the triage board forever, the workflow now archives cards on close and unarchives them on reopen, using the same self-healing logic in the main loop so that label changes on already-closed issues and manual backfills also reconcile correctly.
I reviewed the diff line-by-line and traced the control flow for every event type (labeled, unlabeled, closed, reopened, workflow_dispatch). The key safety improvements all check out:
- Node-ID matching in
archiveCardavoids the per-owner project-number collision risk the author already identified. projectItems(first:100)cap warning means a silently truncated result won’t hide a board-membership miss.- Per-issue
try/catchin the backfill loop prevents one transient GraphQL failure from aborting the entire batch, while single-issue events still fail loudly viacore.setFailed. - Unarchive before re-sync correctly handles the idempotent
addProjectV2ItemByIdreturning an existing archived item as-is.
Security posture is clean: all inputs reach GraphQL only as typed variables, there is no shell or template interpolation of untrusted data, and the least-privilege app-token scopes are unchanged.
There are no application-code changes (no SQL, API routes, UI, or migrations), so the AGENTS.md conventions that apply to product code are not in scope here. The PR checklist appropriately notes N/A for lint/typecheck/tests and correctly omits a changeset since no published package is touched.
No findings — this is ready to merge.
What does this PR do?
The
triage-project-syncworkflow mirrors an issue's triage state onto the Auto-Triage Projects v2 board, but it only ever added/updated cards on label changes, so closed issues stayed on the board forever. This makes board membership track open/closed state. No linked issue (maintainer-initiated CI fix).How:
closedandreopenedto theissuestrigger.addProjectV2ItemByIdreturns an existing item as-is, so the upsert path now callsunarchiveProjectV2Itemexplicitly, ensuring a reopened card returns to the active board.closedevent) means label edits on already-closed issues and the manualworkflow_dispatchbackfill reconcile too, so the board self-heals to "open triaged issues only".try/catchso one failure doesn't abort the batch; single-issue event runs still fail loudly viasetFailed.Archive (over hard delete) was chosen deliberately: it's reversible and preserves any card state, which matters given a recent destructive Projects v2 incident.
Safety: adversarial review pass; HIGH finding (project-number vs node-id match) and several MEDIUM findings (null guard, page-cap warning, resilient backfill loop) addressed. github-script JS syntax-checked,
zizmorclean. Existingorganization-projects: writetoken scope already covers archive/unarchive.After merge, a one-shot
workflow_dispatchrun will archive the closed issues currently on the board.Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure
Screenshots / test output
zizmor --persona=regularreports no findings. YAML validated; embedded github-script syntax-checked withnode --check(async-wrapped).Try this PR
Open a fresh playground →
A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.
Tracks
fix/triage-sync-remove-on-close. Updated automatically when the playground redeploys.