forked from protocolbuffers/protobuf
-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (27 loc) · 850 Bytes
/
janitor.yml
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
name: Protobuf Janitor
on:
schedule:
# Run daily at 10 AM UTC (2 AM PDT)
- cron: 0 10 * * *
workflow_dispatch:
permissions: {}
jobs:
stale-prs:
name: Close Stale Copybara PRs
runs-on: ubuntu-latest
permissions:
contents: write # to allow deleting branches
pull-requests: write # to allow closing the PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
steps:
- run: |
set -ex
STALE_PRS=$(gh pr list --author "app/copybara-service" --limit 500 \
--json "number" --search "updated:<=$(date --date="-7 day" +%F)" \
| jq ".[].number")
for pr in $STALE_PRS; do
echo "Closing #$pr..."
gh pr close --comment "Auto-closing Copybara pull request" --delete-branch "$pr"
done