Skip to content

feat: add stale workflow#2555

Open
MatteoGabriele wants to merge 2 commits intonpmx-dev:mainfrom
MatteoGabriele:feat/stale-workflow
Open

feat: add stale workflow#2555
MatteoGabriele wants to merge 2 commits intonpmx-dev:mainfrom
MatteoGabriele:feat/stale-workflow

Conversation

@MatteoGabriele
Copy link
Copy Markdown
Member

@MatteoGabriele MatteoGabriele commented Apr 17, 2026

🧭 Context

We currently have 20 stale PRs, some of which were created 3+ months ago and have been tagged as stale for more than 2 weeks. I think we need an automated way to deal with these issues and PRs to keep our repository tidy. ✨

📚 Description

It uses the built-in GitHub stale action to automate the entire stale-tagging process and auto-close PRs 14 days after they are tagged.
Issues or PRs will be tagged after 30 days and automatically closed 14 days later.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 17, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Apr 17, 2026 9:41am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Apr 17, 2026 9:41am
npmx-lunaria Ignored Ignored Apr 17, 2026 9:41am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

Adds a new GitHub Actions workflow that runs daily (and on manual dispatch) to mark issues and pull requests stale after 30 days of inactivity and close them after a further 14 days, using the actions/stale action pinned to a commit and processing up to 100 items per run.

Changes

Cohort / File(s) Summary
GitHub Actions workflow
​.github/workflows/close-stale.yml
New workflow Close Stale Issues and PRs scheduled daily at 02:00 UTC with workflow_dispatch. Sets issues and pull-requests write permissions. Job stale runs actions/stale pinned to a commit, marks items stale after 30 days, removes stale on update, closes after 14 more days, includes multi-line messages and operations-per-run: 100.

Sequence Diagram(s)

sequenceDiagram
    participant Scheduler as "GitHub Scheduler\n(cron / workflow_dispatch)"
    participant Runner as "Actions Runner\n(ubuntu-latest)"
    participant StaleAction as "actions/stale\n(pinned commit)"
    participant Repo as "Repository\nIssues & PRs"

    Scheduler->>Runner: trigger workflow
    Runner->>StaleAction: execute with config (30d stale, 14d close, messages, ops limit)
    StaleAction->>Repo: list issues & PRs (up to 100)
    StaleAction->>Repo: add/replace stale labels and post stale messages
    StaleAction->>Repo: remove stale on update (if applicable)
    StaleAction->>Repo: close stale items after additional 14 days
Loading
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add stale workflow' directly and clearly describes the main change: adding a GitHub Actions workflow to automate stale issue and PR management.
Description check ✅ Passed The pull request description clearly explains the motivation (20 stale PRs) and describes the implementation (GitHub stale action to auto-tag after 30 days and auto-close after 14 days), directly relating to the changeset which adds a stale workflow file.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MatteoGabriele MatteoGabriele requested a review from a team April 17, 2026 09:37
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/close-stale.yml:
- Line 17: Replace the floating tag reference "actions/stale@v9" with a pinned
immutable commit SHA by changing the uses line to "uses:
actions/stale@<COMMIT_SHA>" (where <COMMIT_SHA> is the full 40-char commit hash
for the actions/stale repo); ensure the SHA points to the intended release
commit and update dependency management (Dependabot/Renovate) to keep that
pinned SHA current.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ea41e564-6b09-43f8-94e3-fcc889621b49

📥 Commits

Reviewing files that changed from the base of the PR and between 791ce70 and c660415.

📒 Files selected for processing (1)
  • .github/workflows/close-stale.yml

Comment thread .github/workflows/close-stale.yml Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
.github/workflows/close-stale.yml (2)

18-25: Consider adding exempt labels to protect long-lived tracking issues.

Without exempt-issue-labels / exempt-pr-labels (e.g. pinned, security, roadmap, good first issue), legitimately long-running items risk being auto-closed on the first run — especially given the backlog of 20 already-stale PRs that will all be picked up in the initial sweep (operations-per-run: 100).

Proposed addition
           days-before-stale: 30
           days-before-close: 14
           remove-stale-when-updated: true
+          exempt-issue-labels: 'pinned,security,roadmap'
+          exempt-pr-labels: 'pinned,security,dependencies'
+          exempt-draft-pr: true
           stale-issue-label: 'stale'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/close-stale.yml around lines 18 - 25, Add exempt label
configuration to the close-stale workflow so long-lived tracking issues/PRs
aren't auto-closed on the initial sweep: update the job inputs (the block
containing days-before-stale, days-before-close, remove-stale-when-updated,
stale-issue-label, stale-pr-label, close-issue-label, close-pr-label) to include
exempt-issue-labels and exempt-pr-labels with a comma-separated list of labels
to protect (e.g., pinned, security, roadmap, good first issue); keep
operations-per-run and other settings unchanged so the exempt labels are applied
while retaining the current run limits.

24-25: Remove close-issue-label and close-pr-label or use a distinct label.

Setting these to 'stale' is redundant. The stale-*-label options already add the stale label when items are marked stale. The close-*-label options are intended to distinguish items at closure time with a different label (e.g., 'closed-stale'). If the intent is simply to close items marked stale, remove these lines; if a distinct closure marker was intended, use a different label value.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/close-stale.yml around lines 24 - 25, The workflow
currently sets close-issue-label and close-pr-label to 'stale', which is
redundant with the stale-issue-label/stale-pr-label behavior; remove the
close-issue-label and close-pr-label entries from the workflow or replace their
values with a distinct closing label (e.g., 'closed-stale') so closure uses a
different marker. Locate the keys close-issue-label and close-pr-label in the
close-stale.yml and either delete those two lines or change their string values
to the desired distinct label.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/close-stale.yml:
- Around line 18-25: Add exempt label configuration to the close-stale workflow
so long-lived tracking issues/PRs aren't auto-closed on the initial sweep:
update the job inputs (the block containing days-before-stale,
days-before-close, remove-stale-when-updated, stale-issue-label, stale-pr-label,
close-issue-label, close-pr-label) to include exempt-issue-labels and
exempt-pr-labels with a comma-separated list of labels to protect (e.g., pinned,
security, roadmap, good first issue); keep operations-per-run and other settings
unchanged so the exempt labels are applied while retaining the current run
limits.
- Around line 24-25: The workflow currently sets close-issue-label and
close-pr-label to 'stale', which is redundant with the
stale-issue-label/stale-pr-label behavior; remove the close-issue-label and
close-pr-label entries from the workflow or replace their values with a distinct
closing label (e.g., 'closed-stale') so closure uses a different marker. Locate
the keys close-issue-label and close-pr-label in the close-stale.yml and either
delete those two lines or change their string values to the desired distinct
label.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 72f19c1e-8c90-4562-8e07-99f5923e5ff8

📥 Commits

Reviewing files that changed from the base of the PR and between c660415 and 26523a2.

📒 Files selected for processing (1)
  • .github/workflows/close-stale.yml

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

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