Repository navigation
[CI] Add stale pull request label - #5540
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
There was a problem hiding this comment.
🟡 Changes recommended
Critical branch-cleanup safety issues and unresolved permission, timing, and exemption-label problems must be addressed.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds automated cleanup for stale pull requests and branches.
Changes:
- Marks inactive pull requests stale after 30 days and closes them after 7 more days.
- Warns about stale branches after 60 days and removes them after the grace period.
- Adds exemptions for selected labels, protected branches, and branches with open pull requests.
File summaries
| File | Review findings |
|---|---|
.github/workflows/stale-prs.yml |
Moderate: Exemption labels are not currently created or provisioned (1 vote). |
.github/workflows/stale-branches.yml |
Critical: Uses commit author dates instead of last-update timestamps (2 votes); third-party action is mutable-tag referenced (1 vote). Moderate: Missing actions: read permission (2 votes); weekly scheduling extends the effective grace period to roughly 14 days (1 vote). |
Review details
Suppressed comments (2)
.github/workflows/stale-branches.yml:41
- With a weekly Monday schedule, a branch marked stale during one run is usually still just under seven days old at the next Monday check because the comment is posted after the run starts. The v2.4.0 action keeps comments whose timestamp is
>= now - days-before-branch-delete, so deletion is then deferred to the following Monday—roughly 14 days after the warning rather than the documented seven. Author must either run this check at least daily during the grace period or explicitly document and accept the longer effective window.
days-before-branch-stale: 60
days-before-branch-delete: 7
.github/workflows/stale-prs.yml:32
- [verified] The repository currently has no
keep-open,blocked,do-not-close, ordependencieslabel, andactions/staleonly checks for labels named byexempt-pr-labels; it does not provision those exemption labels. The advertised escape hatch therefore cannot be selected in GitHub until the labels are created, so maintainers may be unable to prevent a PR from being closed. Author must create these labels as part of the repository setup or replace them with existing labels.
exempt-pr-labels: 'keep-open,blocked,do-not-close,dependencies'
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
5493cd0 to
ce93432
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Resolve the stale-branch timing, throughput, freshness-safety, and action-pinning findings.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
.github/workflows/stale-branches.yml:50
- [verified] The PR description specifies a 60-day stale threshold for branches, but this input is 30, so branches become eligible for warning/deletion at day 30/37 rather than day 60/67. Author must align the workflow, its comments, and the PR description to one threshold.
.github/workflows/stale-branches.yml:50 - [verified] The pinned action defaults
operations-per-runto 10, and this workflow does not override it. With the 717 branches described as already past the threshold, each weekly run can perform only 10 mark/remove operations; a clean first run therefore warns 10, deletes 10 the following week, and can take roughly 144 weekly runs to drain the backlog. Author must set an explicitoperations-per-runappropriate for the backlog or document this staged rate.
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The branch threshold conflicts with the stated policy, and PR exemption labels are not provisioned.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
.github/workflows/stale-branches.yml:49
- [verified]
docs-websiteis an explicit push/deploy branch in.github/workflows/docs.yml:7,62, but this exemption omits it. If that branch is unprotected and reaches the stale threshold, this job will delete it and remove a documented way to deploy the docs. Author must exemptdocs-websiteor remove that workflow path if the branch is intentionally disposable.
exempt-branches-regex: '^(main|master|gh-pages|stable|release/.*|v[0-9].*)$'
.github/workflows/stale-prs.yml:32
- [verified] None of the four configured exemption labels (
keep-open,blocked,do-not-close,dependencies) exists in the repository's current label set, and this workflow does not provision them. Until they are created separately, the advertised label escape hatch is unavailable and a PR cannot use those exemptions. Author must add these labels as part of the change or replace them with labels that already exist.
exempt-pr-labels: 'keep-open,blocked,do-not-close,dependencies'
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate findings affect stale-label provisioning, action integrity, and branch cleanup correctness.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (3)
.github/workflows/stale-branches.yml:44
- [verified]
remove-stale-branchesderives the branch age from GitHub'sauthoredDate, not the timestamp when the tip commit was created/pushed. A branch whose tip is a recent cherry-pick or rebase commit with an author date older than 30 days can therefore be marked here and deleted after 7 days despite recent activity. Author must use a cleanup implementation that evaluates the tip commit's committed/pushed time or add an equivalent recent-commit guard.
days-before-branch-stale: 30
days-before-branch-delete: 7
.github/workflows/stale-branches.yml:38
⚠️ [verified]ignore-unknown-authorsdefaults tofalsein this action, so its planner skips a branch before stale processing whenever GitHub cannot resolve the latest commit's author. Those branches never receive a warning or get deleted, which makes the stated cleanup incomplete for eligible stale branches. Author must configure an explicit fallback recipient withignore-unknown-authors: true, or document and verify that unknown-author branches are intentionally exempt.
- uses: fpicalausa/remove-stale-branches@7c4f2afe88a36c0f9114cd958380979b9d7323fb # v2.4.0
.github/workflows/stale-prs.yml:24
⚠️ [verified]actions/stale@v10is a mutable tag, while this workflow grants the actionissues: writeandpull-requests: write; a tag move or compromise could therefore replace the code that mutates labels, comments, and PR state. The branch cleanup is pinned for this same reason. Author must pin this action to an immutable commit and update it deliberately.
- uses: actions/stale@v10
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
|
Could we run the stale branch cleanup in dry-run mode for the first one or two weeks before enabling actual deletion? That would give us time to review the branches it would touch and tune the exemption list if needed. PR closing is reversible, but branch deletion is harder to recover from if we miss an important branch. |
9b12a2e to
856022b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Moderate issues remain in branch age detection, label exemptions, and action pinning.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
.github/workflows/stale-branches.yml:52
- [verified] The pinned action decides branch age from the tip commit's
authoredDate, not its commit/push time. For example, a commit pushed today with an author date 60 days ago is eligible immediately, so this workflow can delete a branch that received a commit within the 30-day window described above. Author must use an implementation/version that bases staleness on the commit time, or otherwise prevent this action from treating newly pushed old-authored commits as stale.
- uses: fpicalausa/remove-stale-branches@7c4f2afe88a36c0f9114cd958380979b9d7323fb # v2.4.0
.github/workflows/stale-prs.yml:24
- This workflow grants the action
issues: writeandpull-requests: write, butactions/stale@v10is a mutable tag. The adjacent branch-deletion action is pinned to a full SHA specifically because tags can move; leaving this privileged action tag-pinned allows a later tag retarget to execute unreviewed code with write access and close or modify PRs. Author must pin it to a reviewed full commit SHA.
- uses: actions/stale@v10
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
addressed. |
There was a problem hiding this comment.
🔵 Needs a closer look
The implemented stale/close/delete timings and exemptions in the workflows materially diverge from the PR description and should be reconciled before merging.
Review details
Suppressed comments (5)
Previously missed (2) — in code that hasn't changed since the last review.
.github/workflows/stale-prs.yml:31
- The PR description says PRs should be marked stale after 30 days and closed 7 days later, but this workflow uses 15/15. Please align these values (or update the PR description) to avoid enforcing a different policy than intended.
This issue also appears in the following locations of the same file:
- line 46
- line 51
.github/workflows/stale-prs.yml:39
- The PR description lists additional exempt labels (e.g. blocked, dependencies), but the workflow only exempts do-not-close and keep-open. If those labels are meant to protect PRs from auto-close, they need to be included here.
.github/workflows/stale-prs.yml:50
- This stale warning message is hard-coded to the 15/15 policy; if the intended policy is 30 days to stale and 7 additional days to close (per PR description), update the text so the bot message matches the actual enforcement window.
stale-pr-message: >
This pull request has had no activity for 15 days, so it is now
marked stale. Push a commit, leave a comment, or add the
`keep-open` label within 15 days to keep it open. Closing is not a
judgement on the work — reopen it whenever you pick it back up.
.github/workflows/stale-prs.yml:53
- The close message currently says "Closed after 30 days without activity", which only matches the current 15/15 config; if the intended policy is 30+7 days (per PR description), update this message to reflect the true close timing.
close-pr-message: >
Closed after 30 days without activity. The branch is untouched;
reopen this pull request when the work resumes.
.github/workflows/stale-branches.yml:60
- The PR description says stale branches should be deleted 7 days after the initial 30-day warning, but this workflow sets days-before-branch-delete to 36500, making deletion effectively unreachable. Please reconcile the implementation with the described policy (either change the config and comments to enable deletion, or update the PR description to state that this workflow is warning-only).
days-before-branch-stale: 30
# Effectively never; read the note at the top before changing it.
days-before-branch-delete: 36500
# Upstream's 10 is a standstill here: ~700 branches are past 30
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The implemented workflow behavior (timing, exemptions, and branch deletion policy) has multiple mismatches with the PR description that should be reconciled before merge.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
|
Thanks for the safety improvements. Disabling branch deletion by default, protecting open-PR/protected/release branches, and pinning the actions are good changes. I would still hold this PR:
Please keep this PR limited to stale PR labeling, with automatic closure disabled for now. Move branch cleanup to a separate proposal that includes an explicit archival and recovery design, and make the documented policy match the implementation exactly. |
actions/stale, daily: a pull request is labelled `stale` after 15 days without activity; any push or comment clears it. Nothing is closed -- -1, since leaving it unset would mean the action's 7-day default. Drafts and PRs labelled keep-open, blocked, do-not-close or dependencies are exempt. Issues are out of scope. Pinned to the v10.4.0 commit. Branch cleanup is proposed separately, with archival before deletion, on satya/stale_branch_archive.
b43d835 to
461e969
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The workflow’s stale/close timings and messaging are inconsistent with the PR description and should be aligned before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
Resolved since last review (1)
addressed |
brunomazzottiamd
left a comment
There was a problem hiding this comment.
What should we do with this PR? The last comment states that the suggestions are addressed, and it's from last week.
leo-automation
left a comment
There was a problem hiding this comment.
nit: The PR needs title and desc updated
This isn't a nitpick IMHO, it's a good practice. The worst situation is when you have to dig thought ancient PRs to understand what happened and find outdated / unreliable information... |
Updated exempt PR labels to only include 'do-not-close'.


actions/stale, daily: a pull request is labelled stale after 15 days without activity; a push or comment clears it. Nothing is closed — days-before-pr-close is -1, since leaving it unset would mean the action's 7-day default. Drafts and PRs labelled do-not-close are exempt. Issues are out of scope. The action is pinned to the v10.4.0 commit.
Branch cleanup is proposed separately, with archival before deletion, in satya/stale_branch_archive