Skip to content

ci: close community PRs that are not linked to an issue - #1633

Open
vishxrad wants to merge 4 commits into
mainfrom
ci/require-linked-issue
Open

vishxrad wants to merge 4 commits into
mainfrom
ci/require-linked-issue

Conversation

@vishxrad

@vishxrad vishxrad commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What

CONTRIBUTING.md asks every contribution to start with an issue, but nothing enforces it. This adds a workflow that closes community pull requests that don't close an open issue, and reopens them once they do.

Changes

  • New .github/workflows/require-linked-issue.yml, running on pull_request_target (opened, reopened, edited, labeled). It never checks out PR code, and re-reads the PR at the start of each run so labels, state and body are current. Runs for the same PR are queued, not cancelled.
  • A PR that doesn't close an open issue gets a needs-linked-issue label, a comment explaining how to fix it, and is closed. The comment is only posted the first time; later re-closes don't repeat it. Editing the description to close an issue removes the label and reopens the PR.
  • A PR counts as linked only if GitHub's closingIssuesReferences for it contains an open issue in this repo, i.e. exactly what GitHub shows under "Development" (a closing keyword such as Closes #123 in the description, or a sidebar link). Plain mentions (see #123), closed issues and issues in other repos do not count. GitHub links issues a moment after a PR is opened or edited, so the lookup is retried up to 4 times, 5s apart, before the PR is closed. If every lookup errors, the run fails and the PR is left open.
  • Maintainer overrides:
    • Adding the no-issue-needed label skips the check; on a flagged PR it also removes needs-linked-issue and reopens it.
    • A maintainer manually reopening a closed PR adds no-issue-needed (instead of the check closing it again), so later edits by the author don't re-close it.
  • Skipped: org owners/members/collaborators, anyone with write access to the repo, bots, PRs created before ENFORCE_AFTER (2026-11-13T00:00:00Z), and PRs carrying no-issue-needed.

Known limits: it does not check that a maintainer approved the issue. Linking an issue via the sidebar after the PR is closed does not fire an event, so the PR reopens on the next description edit.

Test Plan

  • Not applicable (explain why)
  • Verified locally

Ran the inline script against mocked GitHub API responses: no link, linked immediately, linked only after retries (indexing delay), only a closed issue, only an issue in another repo, lookup erroring every time (no close) or once, maintainer reopen of a flagged PR, author reopen of a flagged PR (no duplicate comment), reopen on edit, exempt label added to a closed flagged PR, unrelated label added, returning contributor (CONTRIBUTOR), org member, write access, and pre-cutoff PR. It has not run on GitHub: pull_request_target workflows only run from the default branch, so it takes effect after merge.

Checklist

  • I linked a related issue, if applicable
  • I updated docs/README when needed
  • I considered backwards compatibility

🤖 Generated with Claude Code

Link to Devin session: https://app.devin.ai/sessions/957449ac65bf4c50b4c5826645fe1d41
Open in Devin Desktop: https://app.devin.ai/desktop/session/957449ac65bf4c50b4c5826645fe1d41?variant=devin

Adds a pull_request_target workflow that labels, comments on and closes
PRs with no linked issue, and reopens them once the description references
one. Org members, anyone with write access, bots, PRs opened before the
cutoff and PRs labelled no-issue-needed are skipped.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openui-docs Ready Ready Preview Nov 13, 2026 9:34am UTC

Request Review

…erride

- Require a closing keyword (Closes/Fixes/Resolves) or sidebar link to an
  open issue in this repo; plain mentions no longer count.
- A maintainer reopening a closed PR adds no-issue-needed instead of the
  check closing it again.
- Adding no-issue-needed to a flagged PR removes the flag and reopens it.
- Post the explanation comment only the first time a PR is closed.
- Re-read the PR at the start of each run so labels/state are current.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ption

Drop the description regex and query closingIssuesReferences up to 4 times,
5s apart, so links GitHub has not indexed yet are not missed. If every
lookup errors, fail the run instead of closing the PR.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — fc549205 Deployed Nov 13, 2026 by vercel[bot]
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.

1 participant