- Notify the author when their PR has been in draft state with no new commits for three weeks - Close the draft PRs that didn't get updated after one more week - Re-try the cla-bot check on PRs that are still unsigned after a week - Close the PRs that are still unsigned after the re-try ## Testing It works on my machine™ ``` python script/github-pr-cleanup.py --dry-run Checking 713 open pull requests Dry-run mode: no comments or closures will be made PR #60885: asking the CLA bot to check again Would comment on PR #60885: @cla-bot check PR #61625: asking the CLA bot to check again Would comment on PR #61625: @cla-bot check PR #57239: warning about a stale draft Would comment on PR #57239: <!-- zed-community-automation:stale-draft-warning --> This pull request has remained in draft without new commits for three weeks. If it remains a draft without new commits for another week, it will be closed automatically. PR #57241: warning about a stale draft Would comment on PR #57241: <!-- zed-community-automation:stale-draft-warning --> This pull request has remained in draft without new commits for three weeks. If it remains a draft without new commits for another week, it will be closed automatically. PR #61461: warning about a stale draft Would comment on PR #61461: <!-- zed-community-automation:stale-draft-warning --> This pull request has remained in draft without new commits for three weeks. If it remains a draft without new commits for another week, it will be closed automatically. PR #61722: warning about a stale draft Would comment on PR #61722: <!-- zed-community-automation:stale-draft-warning --> This pull request has remained in draft without new commits for three weeks. If it remains a draft without new commits for another week, it will be closed automatically. PR #61808: warning about a stale draft Would comment on PR #61808: <!-- zed-community-automation:stale-draft-warning --> This pull request has remained in draft without new commits for three weeks. If it remains a draft without new commits for another week, it will be closed automatically. PR #61809: warning about a stale draft Would comment on PR #61809: <!-- zed-community-automation:stale-draft-warning --> This pull request has remained in draft without new commits for three weeks. If it remains a draft without new commits for another week, it will be closed automatically. Cleanup complete: 0 unsigned PR closures, 6 draft warnings, 0 draft closures ``` Release Notes: - N/A
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
# Warn and close pull requests that remain in draft without new commits, and
|
|
# close unsigned community pull requests that have not engaged about CLA trouble.
|
|
|
|
name: Community PR Cleanup
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "30 8 * * *"
|
|
workflow_dispatch:
|
|
inputs:
|
|
dry-run:
|
|
description: "Print what would be done without actually posting comments or closing pull requests"
|
|
type: boolean
|
|
default: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: community-pr-cleanup
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
cleanup:
|
|
if: github.repository == 'zed-industries/zed'
|
|
runs-on: namespace-profile-2x4-ubuntu-2404
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Generate app token
|
|
id: app-token
|
|
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
|
|
with:
|
|
app-id: ${{ secrets.ZED_COMMUNITY_BOT_APP_ID }}
|
|
private-key: ${{ secrets.ZED_COMMUNITY_BOT_PRIVATE_KEY }}
|
|
owner: zed-industries
|
|
repositories: zed
|
|
permission-issues: write
|
|
permission-pull-requests: write
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
|
|
with:
|
|
sparse-checkout: |
|
|
script/github-pr-cleanup.py
|
|
sparse-checkout-cone-mode: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dependencies
|
|
run: pip install requests
|
|
|
|
- name: Clean up pull requests
|
|
env:
|
|
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
run: python script/github-pr-cleanup.py ${{ inputs.dry-run && '--dry-run' || '' }}
|