Skip to content

Editorial: Add workflow to automatically close stale draft pull requests#2749

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-auto-close-draft-prs
Draft

Editorial: Add workflow to automatically close stale draft pull requests#2749
Copilot wants to merge 2 commits intomainfrom
copilot/add-auto-close-draft-prs

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 12, 2026

Adds a weekly GitHub Actions workflow that automatically closes open draft PRs with no activity for more than 6 calendar months, posting an explanatory comment before closing. Non-draft PRs are never affected.

Workflow (.github/workflows/close-stale-draft-prs.yml)

  • Triggers: weekly schedule (Mondays 00:00 UTC) + workflow_dispatch
  • Iterates all open PRs with pagination; skips any PR where draft === false (explicit guardrail)
  • Staleness cutoff: updated_at < now - 6 months (exact calendar months via Date.setMonth)
  • On match: posts a comment explaining the closure and that the PR can be reopened, then sets state to closed
  • Permissions: pull-requests: write only — no other scopes granted

Documentation (documentation/process.md)

  • Added a callout under the existing draft PR paragraph describing the automated clean-up behaviour so contributors are aware.

  • For every spec that this PR edits, please add the appropriate spec:<spec_name> label. If you don't have privileges to do this, editors will do it for you.
  • If the change is editorial, please add "Editorial:" at the start of your PR name, and delete the "Test, Documentation and Implementation tracking" section below.
Original prompt

Create a GitHub Actions workflow in the existing repository w3c/aria that automatically closes pull requests that are:

  • In draft state, AND
  • Have had no activity for more than 6 months.

Requirements:

  1. Implement as a GitHub Actions workflow under .github/workflows/.
  2. The workflow should run on a schedule (e.g., daily or weekly) and also support manual workflow_dispatch.
  3. "Activity" should be based on GitHub’s PR timeline/updated timestamp (e.g., updated_at) so that comments, commits, reviews, label changes, or other interactions reset the inactivity timer.
  4. Only close PRs that are currently open and draft.
  5. When closing, add a brief comment explaining it was closed automatically due to 6+ months of inactivity while in draft, and that maintainers can reopen if needed.
  6. Use least-privilege permissions in the workflow (only what’s required to read PRs and close/comment).
  7. Use a well-known, maintained action to perform stale/close logic (preferred: actions/stale) OR implement equivalent logic via actions/github-script if necessary. Ensure draft-only behavior.
  8. Include guardrails to avoid closing non-draft PRs.
  9. Add/adjust documentation in README.md or contributing docs if the repo has a standard place to document automation.
  10. Open a pull request with the changes.

Acceptance criteria:

  • A PR exists in w3c/aria adding the workflow.
  • Draft PRs with > 6 months inactivity get commented and closed by the workflow.
  • Non-draft PRs are not affected.
  • Workflow is secure (minimal permissions) and clear.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: create an action to automatically close any Draft PR that hasn't had any activity for more than 6 months

Assistant: I’ve queued up the automation change, and I’m waiting on your approval in the confirmation dialog before I can proceed with creating/updating the workflow in w3c/aria.

User: please create a PR for this instead

Assistant: I can’t proceed with creating the pull request right now because I don’t currently have access to the GitHub automation needed to make changes in w3c/aria.

If you paste (or confirm) the repo’s default branch name (usually main) and tell me whether you prefer a daily or weekly schedule, I’ll provide the exact workflow file content and the PR description text you can use to open the PR from your side.

This pull request was created from Copilot chat.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 12, 2026

Deploy Preview for wai-aria ready!

Name Link
🔨 Latest commit 2be382f
🔍 Latest deploy log https://app.netlify.com/projects/wai-aria/deploys/69b2ec6dc015920008cf7230
😎 Deploy Preview https://deploy-preview-2749--wai-aria.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-authored-by: jnurthen <1724479+jnurthen@users.noreply.github.com>
Copilot AI changed the title [WIP] Add workflow to auto close draft PRs after 6 months of inactivity Editorial: Add workflow to automatically close stale draft pull requests Mar 12, 2026
Copilot AI requested a review from jnurthen March 12, 2026 16:41
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