Skip to content

Stale Bot

Stale Bot #1185

Workflow file for this run

name: Stale Bot
on:
issues:
types: [labeled]
pull_request:
types: [labeled]
schedule:
- cron: '0 * * * *'
permissions:
issues: write
pull-requests: write
jobs:
send-stale-message:
runs-on: ubuntu-latest
if: github.event.label.name == 'stale'
steps:
- name: Send stale message
uses: actions/github-script@v7
with:
script: |
const issueNumber = context.payload.issue?.number || context.payload.pull_request?.number;
const isPR = !!context.payload.pull_request;
const itemType = isPR ? 'PR' : 'issue';
if (!issueNumber) {
console.error('Could not determine issue/PR number');
return;
}
const staleMessage = `This ${itemType} has been marked as stale because it has been inactive.
It will be automatically closed in 1 day unless there is new activity.
If this is still relevant, please add a comment to keep it active.
Thank you for your contribution to the Rainbond project! 🙏`;
await github.rest.issues.createComment({
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: staleMessage
});
scheduled-stale-check:
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
steps:
- name: Run scheduled stale check
uses: actions/stale@v9
with:
# basic configurations
days-before-stale: -1
days-before-close: 1
# Issue configurations
stale-issue-message: ''
close-issue-message: |
This issue has been automatically closed due to inactivity.
If the issue still exists, please reopen or create a new issue.
stale-issue-label: 'stale'
stale-pr-message: ''
close-pr-message: |
This PR has been automatically closed due to inactivity.
If the changes are still relevant, please reopen or create a new PR.
stale-pr-label: 'stale'
only-labels: 'stale'
exempt-all-milestones: true
remove-stale-when-updated: true
operations-per-run: 100
exempt-draft-pr: true
ascending: true
delete-branch: false