mirror of
https://github.com/Sonarr/Sonarr
synced 2026-05-08 04:50:56 +02:00
Auto close stale Draft PRs
This commit is contained in:
parent
710737f2e2
commit
710a6ea078
1 changed files with 26 additions and 0 deletions
26
.github/workflows/close_stale_draft_prs.yml
vendored
Normal file
26
.github/workflows/close_stale_draft_prs.yml
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
name: Close stale draft PRs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
close-stale-drafts:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'Sonarr/Sonarr'
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Close draft PRs inactive for 90+ days
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
run: |
|
||||
cutoff=$(date -u -d '90 days ago' +%Y-%m-%dT%H:%M:%SZ)
|
||||
gh pr list --draft --state open --limit 1000 \
|
||||
--json number,updatedAt \
|
||||
--jq ".[] | select(.updatedAt < \"$cutoff\") | .number" \
|
||||
| while read -r pr; do
|
||||
gh pr close "$pr" --comment ":wave: This draft pull request has been closed automatically because it has not had any activity in 90 days. If you are still working on this, please update it and let us know so we can reopen it."
|
||||
done
|
||||
Loading…
Reference in a new issue