-
Notifications
You must be signed in to change notification settings - Fork 22
31 lines (27 loc) · 1.21 KB
/
pr-update-reminder.yml
File metadata and controls
31 lines (27 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: Stale Pull Request Reminder
on:
schedule:
- cron: '0 0 * * *' # Runs daily
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
remind-stale-prs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Post reminder on stale PRs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Posting reminders on stale pull requests..."
curl -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls \
| jq -r '.[] | select(.updated_at < (now - 2592000 | todate)) | .number' \
| while read -r pr_number; do
echo "Commenting on PR #$pr_number..."
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$pr_number/comments \
-d '{"body": "This pull request has been inactive for 30 days. Please update it or let us know if it is still relevant."}'
done