Skip to content

Commit 77c5da9

Browse files
kkawulacptartur
andauthored
Stale bot (#2842)
<!-- Reference any GitHub issues resolved by this PR --> Closes #2816 Settings reference: https://github.com/actions/stale?tab=readme-ov-file#all-options ## Introduced changes <!-- A brief description of the changes --> - ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [x] Updated relevant documentation - [x] Added relevant tests - [x] Performed self-review of the code - [x] Added changes to `CHANGELOG.md` --------- Co-authored-by: Artur Michałek <[email protected]>
1 parent 491eb97 commit 77c5da9

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

Diff for: .github/workflows/automate-stale.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Automation - Stale issues and PRs'
2+
3+
on:
4+
schedule:
5+
- cron: '0 7 * * 1-5'
6+
7+
env:
8+
DAYS_BEFORE_STALE: 30
9+
DAYS_BEFORE_CLOSE: 14
10+
11+
jobs:
12+
stale:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pull-requests: write
16+
steps:
17+
- name: Run Stale Bot
18+
id: stale
19+
uses: actions/stale@v9
20+
with:
21+
# General settings
22+
days-before-stale: ${{ env.DAYS_BEFORE_STALE }}
23+
days-before-close: ${{ env.DAYS_BEFORE_CLOSE }}
24+
operations-per-run: 3000
25+
enable-statistics: true # This is only useful if secret ACTIONS_STEP_DEBUG=true
26+
remove-stale-when-updated: true
27+
28+
# PR settings
29+
stale-pr-label: stale
30+
stale-pr-message: |
31+
Hi! This pull request hasn't had any activity for a while, so I am
32+
marking it as stale. It will close in ${{ env.DAYS_BEFORE_CLOSE }}
33+
days if it is not updated. Thanks for contributing!
34+
close-pr-message: false
35+
36+
- name: Print outputs
37+
run: |
38+
issues_and_prs=$(echo ${{ toJSON(steps.stale.outputs.staled-issues-prs) }})
39+
closed_issues_and_prs=$(echo ${{ toJSON(steps.stale.outputs.closed-issues-prs) }})
40+
41+
echo "Staled Issues/PRs:"
42+
echo "$issues_and_prs" | jq -r '.[] | "Title: \(.title)\nNumber: \(.number)\nCreated At: \(.created_at)\nUpdated At: \(.updated_at)\nDraft: \(.draft)\n---"'
43+
44+
echo "Closed Issues/PRs:"
45+
echo "$closed_issues_and_prs" | jq -r '.[] | "Title: \(.title)\nNumber: \(.number)\nCreated At: \(.created_at)\nUpdated At: \(.updated_at)\nDraft: \(.draft)\n---"'

0 commit comments

Comments
 (0)