Skip to content

ci: add workflow to clean up stale PRs and issues#792

Merged
DaleSeo merged 1 commit into
mainfrom
chore/stale-workflow
Jul 21, 2026
Merged

ci: add workflow to clean up stale PRs and issues#792
DaleSeo merged 1 commit into
mainfrom
chore/stale-workflow

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Jul 17, 2026

Copy link
Copy Markdown
Member

Adds a scheduled GitHub Actions workflow that keeps the issue and PR backlog tidy by marking inactive items stale and closing them if they stay quiet. It runs actions/stale@v10 daily so that items with no activity for 60 days get a Stale label plus an explanatory comment, and are closed 14 days later if still inactive.

@apollo-librarian

apollo-librarian Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: e25faf9d07b2aa66196ac8a0
Build Logs: View logs


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a daily and manually triggered GitHub Actions workflow that marks inactive issues and pull requests stale after 60 days and closes them 14 days later, with label and draft exemptions.

Changes

Stale cleanup workflow

Layer / File(s) Summary
Stale cleanup workflow configuration
.github/workflows/stale.yml
Adds actions/stale@v10 with scheduled and manual triggers, write permissions, 60-day stale and 14-day close periods, exemptions, and custom issue and pull request messages.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No substantive pull request description was provided, so its relation to the changeset cannot be meaningfully assessed. Add a brief description of the workflow change and its purpose, such as the stale PR/issue cleanup behavior.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding a workflow to clean up stale PRs and issues.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@DaleSeo DaleSeo changed the title chore: add workflow to clean up stale PRs and issues ci: add workflow to clean up stale PRs and issues Jul 17, 2026
@DaleSeo
DaleSeo marked this pull request as ready for review July 17, 2026 19:56
@DaleSeo
DaleSeo requested a review from a team as a code owner July 17, 2026 19:56
@DaleSeo DaleSeo self-assigned this Jul 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/stale.yml:
- Line 15: Update the actions/stale workflow step to reference a specific full
commit SHA instead of the mutable v10 tag, preserving the existing action
configuration and permissions.
- Around line 11-13: Update the workflow permissions block to add actions: write
alongside the existing issues and pull-requests permissions, ensuring the job
grants actions/stale@v10 the required Actions scope.
- Around line 2-5: Add a workflow-level concurrency configuration alongside the
triggers in the stale workflow, using a shared group and setting
cancel-in-progress to false so scheduled and manually dispatched runs queue
rather than overlap. Keep the existing schedule and workflow_dispatch triggers
unchanged.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7f921e1d-3f44-4366-ac61-e3616e90480c

📥 Commits

Reviewing files that changed from the base of the PR and between 6757bbc and e391e5a.

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

Comment on lines +2 to +5
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '1,220p' .github/workflows/stale.yml | cat -n

Repository: apollographql/apollo-mcp-server

Length of output: 1739


🏁 Script executed:

#!/bin/bash
set -euo pipefail
if [ -f .github/workflows/stale.yml ]; then
  cat -n .github/workflows/stale.yml
else
  echo "missing"
fi

Repository: apollographql/apollo-mcp-server

Length of output: 1739


🏁 Script executed:

rg -n "^concurrency:|cancel-in-progress:" .github/workflows

Repository: apollographql/apollo-mcp-server

Length of output: 648


Serialize scheduled and manual runs. Add a workflow-level concurrency group with cancel-in-progress: false so schedule and workflow_dispatch runs queue instead of overlapping and racing duplicate stale comments or label/close mutations.

Proposed fix
 on:
   schedule:
     - cron: "0 0 * * *"
   workflow_dispatch:
 
+concurrency:
+  group: stale-cleanup
+  cancel-in-progress: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
concurrency:
group: stale-cleanup
cancel-in-progress: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/stale.yml around lines 2 - 5, Add a workflow-level
concurrency configuration alongside the triggers in the stale workflow, using a
shared group and setting cancel-in-progress to false so scheduled and manually
dispatched runs queue rather than overlap. Keep the existing schedule and
workflow_dispatch triggers unchanged.

Source: MCP tools

Comment on lines +11 to +13
permissions:
issues: write
pull-requests: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- .github/workflows/stale.yml ---'
cat -n .github/workflows/stale.yml

echo
echo '--- search for stale action usage/docs in repo ---'
rg -n "actions/stale|operation limit|actions: write|permissions:" .github/workflows . -g '!**/node_modules/**' || true

Repository: apollographql/apollo-mcp-server

Length of output: 3146


🌐 Web query:

actions/stale v10 permissions actions write cache state operation limit

💡 Result:

To resolve issues with the actions/stale v10+ action regarding cache state and operation limits, you must explicitly grant the actions: write permission in your workflow configuration [1][2][3]. Background and Permissions The actions/stale action utilizes the GitHub Actions Cache to maintain state between workflow runs [2][4]. When the number of processed items exceeds the configured operations-per-run limit (default: 30), the action stores its progress in the cache [5][4]. If a subsequent run needs to update or replace this cache, it may trigger an error (e.g., 403 Forbidden) if the workflow lacks sufficient permissions to manage cache entries [4][3][6]. Granting actions: write allows the action to delete and update existing cache entries as needed [2][4][3]. Recommended Configuration The official recommendation for actions/stale is to include the following permissions block in your workflow file [1][7]: permissions: actions: write contents: write # Required if using the delete-branch option issues: write pull-requests: write Note that while actions: write is essential for cache state management, contents: write is specifically required only if you have enabled the delete-branch feature [1][8]. The issues: write and pull-requests: write permissions are necessary for the action's core functionality of labeling, commenting on, and closing issues or pull requests [1][5]. If your repository has restricted default token permissions, omitting these explicit settings will likely result in "Insufficient permissions" or "Resource not accessible by integration" errors during cache operations or when attempting to modify repository items [5][9][10].

Citations:


Add actions: write to the job permissions. actions/stale@v10 uses Actions cache state once it hits its operation limit; without that scope, large backlogs can keep restarting from the same items instead of making progress.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/stale.yml around lines 11 - 13, Update the workflow
permissions block to add actions: write alongside the existing issues and
pull-requests permissions, ensuring the job grants actions/stale@v10 the
required Actions scope.

Source: MCP tools

issues: write
pull-requests: write
steps:
- uses: actions/stale@v10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git ls-files .github/workflows/stale.yml
echo '---'
cat -n .github/workflows/stale.yml

Repository: apollographql/apollo-mcp-server

Length of output: 1771


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('.github/workflows/stale.yml')
print(p.exists())
if p.exists():
    text = p.read_text()
    for i, line in enumerate(text.splitlines(), 1):
        if 'actions/stale' in line or 'uses:' in line:
            print(f"{i}: {line}")
PY

Repository: apollographql/apollo-mcp-server

Length of output: 210


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the workflow and nearby context.
sed -n '1,80p' .github/workflows/stale.yml

Repository: apollographql/apollo-mcp-server

Length of output: 1494


Pin actions/stale to a full commit SHA.
actions/stale@v10 is mutable, and this workflow has write access to issues and pull requests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/stale.yml at line 15, Update the actions/stale workflow
step to reference a specific full commit SHA instead of the mutable v10 tag,
preserving the existing action configuration and permissions.

Source: MCP tools

@DaleSeo
DaleSeo merged commit 96a984b into main Jul 21, 2026
17 checks passed
@DaleSeo
DaleSeo deleted the chore/stale-workflow branch July 21, 2026 19:33
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