Skip to content

Commit

Permalink
Add a script for cleaning up stale copybara PRs
Browse files Browse the repository at this point in the history
This was tested locally over a smaller set of PRs, resulting in:
#13557

PiperOrigin-RevId: 560101257
  • Loading branch information
mkruskal-google authored and Copybara-Service committed Aug 25, 2023
1 parent e59301b commit 019ab88
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/janitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Protobuf Janitor

on:
schedule:
# Run daily at 10 AM UTC (2 AM PDT)
- cron: 0 10 * * *
workflow_dispatch:

jobs:
stale-prs:
- name: Close Stale Copybara PRs
runs-on: ubuntu-latest
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
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 019ab88

Please sign in to comment.