Skip to content

feat: Add stale PR auto-close workflow#2386

Merged
k11kirky merged 1 commit into
mainfrom
05-26-add_stale_pr_auto-close_workflow
May 27, 2026
Merged

feat: Add stale PR auto-close workflow#2386
k11kirky merged 1 commit into
mainfrom
05-26-add_stale_pr_auto-close_workflow

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented May 27, 2026

Problem

I remember a time when we could regularly hit 0 open PR's on this repo, that seems unlikely to ever happen again (which is a good thing!). The other side of that means we need some automation here so inactivate PRs don't accumulate and clutter the PR list.

Changes

  1. Add daily workflow using actions/stale@v9
  2. Mark PRs stale after 30 days of inactivity
  3. Close stale PRs 7 days later (37 days total)
  4. Exempt PRs labeled no stale or security
  5. Issues are disabled for now (PR-only), can be enabled later

How did you test this?

I did not

Publish to changelog?

no

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title Add stale PR auto-close workflow feat: Add stale PR auto-close workflow May 27, 2026
@charlesvien charlesvien marked this pull request as ready for review May 27, 2026 03:13
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 27, 2026

T-Rex T-Rex Logs

What T-Rex did

  • Parsed the stale workflow YAML with PyYAML and saved the structured JSON to trex-artifacts/stale-yml-parsed.json; the structure is syntactically valid.
  • Looked up actions/stale@v9 README and found it requires issues: write and pull-requests: write, since the action reads both issues and PRs via the REST API.
  • Compared the workflow's permissions block, which only grants pull-requests: write, and concluded the action would fail to enumerate items under restricted token permissions, affecting PR listing.
  • Verified days-before-issue-stale: -1 and days-before-issue-close: -1 disable staling and closing per docs, but they do not remove the need for the Issues API listing.
  • Analyzed exempt-pr-labels: "no stale,security" and noted the comma-split yields ['no stale','security'], with the space-containing name suggesting a potential label mismatch against conventional naming.
  • Confirmed exempt-draft-pr: false matches the PR description (drafts are not exempt).
  • Did not modify any source; findings are documented in trex-artifacts/stale-workflow-analysis.md.
Artifacts

Parsed stale workflow YAML with PyYAML

  • Evidence that the YAML was parsed into structured JSON and saved, showing the parsing outcome and syntactic validity.

Stale workflow permission analysis

  • Markdown notes detailing permission requirements, disabled-stale behavior, and label-name observations used to assess workflow feasibility.

T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
.github/workflows/stale.yml:15-16
**Add issues permission**

`actions/stale` fetches pull requests through the Issues API, and its recommended permissions include both `issues: write` and `pull-requests: write`. With only `pull-requests: write`, this scheduled workflow can fail with a token permission error before it labels or closes any stale PRs, especially in repositories with restricted default workflow permissions.

```suggestion
    permissions:
      issues: write
      pull-requests: write
```

Reviews (1): Last reviewed commit: "Add stale PR auto-close workflow" | Re-trigger Greptile

Comment thread .github/workflows/stale.yml
@k11kirky k11kirky merged commit 9d44397 into main May 27, 2026
15 checks passed
@k11kirky k11kirky deleted the 05-26-add_stale_pr_auto-close_workflow branch May 27, 2026 08:28
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