Skip to content

Mark draft PRs as stale after 7 days, close after 7 more#21378

Closed
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/1774991931-stale-draft-prs
Closed

Mark draft PRs as stale after 7 days, close after 7 more#21378
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/1774991931-stale-draft-prs

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Adds two custom gh-based steps to the stale workflow to handle draft PRs on a faster schedule than the default 14/14 day cycle:

  • Mark stale draft PRs: Finds open draft PRs with no activity for 7 days and applies the status:stale label with a comment.
  • Close stale draft PRs: Finds draft PRs already labeled status:stale with no activity for 7 more days, comments, and closes them.

Both steps respect the existing status:exempt label. The actions/stale step continues to handle non-draft PRs on the existing 14-day schedule. Since actions/stale doesn't support filtering by draft status natively, the custom steps use gh pr list --draft with jq filters instead.

Things to verify in review:

  • The jq inside filter used for the "not already stale" check — consider whether any(. == "status:stale") | not would be clearer and more robust (especially for PRs with no labels, where inside may behave unexpectedly).
  • Whether draft PRs should be explicitly excluded from the actions/stale step to avoid any overlap in processing.
  • updatedAt resets when the stale label is added via gh pr edit, which is what makes the 7-day close window work — worth confirming this assumption.

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • If this pull request adds new functionality, it includes unit tests that cover the changes
    • N/A — workflow-only change, not testable via unit tests
  • If this pull request removes docs files, it includes redirect settings in mint.json.
    • N/A
  • If this pull request adds functions or classes, it includes helpful docstrings.
    • N/A

Link to Devin session: https://app.devin.ai/sessions/d481a0da7f704d28b2893aa40c454d83
Requested by: @desertaxle

devin-ai-integration bot and others added 2 commits March 31, 2026 21:19
Add two custom steps before the actions/stale step to handle draft PRs
on a faster schedule:
- Mark stale draft PRs: finds open draft PRs inactive for 7 days,
  adds status:stale label and a comment
- Close stale draft PRs: finds draft PRs with status:stale label
  inactive for 7 days, comments and closes them

Draft PRs with status:exempt label are skipped. Non-draft PRs continue
to use the existing 14-day schedule via actions/stale.

Co-Authored-By: alex.s <ajstreed1@gmail.com>
Co-authored-by: alex.s <alex.s@prefect.io>
Co-Authored-By: alex.s <ajstreed1@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-authored-by: alex.s <alex.s@prefect.io>
Co-Authored-By: alex.s <ajstreed1@gmail.com>
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