Skip to content

feat: label issues close:fixed when a merged PR closes them#213

Merged
EMaher merged 5 commits into
mainfrom
emaher-close-fixed-label-workflow
Jul 2, 2026
Merged

feat: label issues close:fixed when a merged PR closes them#213
EMaher merged 5 commits into
mainfrom
emaher-close-fixed-label-workflow

Conversation

@EMaher

@EMaher EMaher commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new GitHub Actions workflow that automatically applies the existing close:fixed label to issues that were auto-closed by a merged pull request (via Closes #N / Fixes #N / Resolves #N linking keywords). This keeps the close reason visible in issue triage, consistent with the manual close:* taxonomy defined in the label sync workflow.

What the branch delivers

  • New workflow .github/workflows/issue-label-fixed-on-merge.yml ("Label Fixed Issues on Merge"):
    • Triggers on pull_request_target: [closed] and only acts when pull_request.merged == true.
    • Resolves the closed issues authoritatively via GraphQL closingIssuesReferences (mirrors exactly what GitHub closed on merge — not fragile PR-body parsing).
    • Applies close:fixed to each closed issue, skipping any that already carry the label.
    • Ensures the label exists with its canonical color/description (0E8A16 / "Fixed by a previous PR or release") if a fresh repo is missing it.
  • Docs: Updated CONTRIBUTING.md to note that merged PRs auto-label their closed issues close:fixed.

Design notes

  • Uses pull_request_target (not pull_request) so PRs from forks still receive an issues: write token and get labeled. The workflow never checks out or executes PR head code — it only calls the GitHub API via actions/github-script — so there is no untrusted-code execution risk.
  • The close:fixed label itself is already defined in .github/workflows/issue-labels-sync.yml (CLOSE_LABELS); this workflow reuses it.

Validation

  • YAML parsed successfully.
  • Embedded github-script JavaScript passes node --check.

Related Issue(s)

N/A — proactive automation improvement.

EMaher and others added 5 commits July 1, 2026 14:29
Add the "Label Fixed Issues on Merge" workflow. On pull_request_target
closed, when the PR was merged, it resolves the issues closed via linking
keywords (Closes/Fixes/Resolves) using GraphQL closingIssuesReferences and
applies the existing close:fixed label to each, keeping the close reason
visible in issue triage.

Uses pull_request_target so fork PRs still get issues:write; no PR head
code is checked out or executed. Skips issues that already carry the label
and ensures the label exists with its canonical color/description.

Also documents the auto-labeling in CONTRIBUTING.md.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove the defensive label-creation block and the FIXED_LABEL_COLOR/
FIXED_LABEL_DESCRIPTION env vars. issue-labels-sync.yml already defines and
creates close:fixed and is the single source of truth for its color and
description, so duplicating them here only created a maintenance coupling.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fail fast via core.setFailed if the label does not exist, rather than letting addLabels silently create a default-colored variant. Signals the label taxonomy is out of sync and the Sync Labels workflow needs to run.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Split the close:fixed existence check out of the apply step into a dedicated 'Verify close:fixed label exists' step that runs first, so the run fails before any labeling work when the label is missing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@EMaher EMaher merged commit 1d85e30 into main Jul 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants