The best way to control Claude Code, Codex and more from any computer or phone

main
yml 72 lines 2.65 KB
Raw
1 name: PR Limits
2
3 # Deterministic PR rules from CONTRIBUTING.md: the open PR limit, the conflict
4 # window, and the 72 hour close window that follows a triage notice.
5 #
6 # Nothing is labeled, commented on, or closed until the repository variable
7 # PR_LIMITS_ENFORCE is "true". Until then every run logs what it would do. A
8 # sweep reads the variable once when it starts; to stop one, cancel the run.
9
10 on:
11 pull_request_target:
12 types: [opened, reopened]
13 schedule:
14 - cron: "23 5 * * *"
15 workflow_dispatch:
16 inputs:
17 dry_run:
18 description: Log what the sweep would do without labeling, commenting, or closing.
19 type: boolean
20 default: true
21
22 permissions:
23 contents: read
24 issues: write
25 pull-requests: write
26
27 jobs:
28 open-limit:
29 name: Open PR limit
30 if: github.event_name == 'pull_request_target'
31 runs-on: ubuntu-24.04
32 steps:
33 # pull_request_target has a write token. Load the script from the default
34 # branch and never run PR code. Cone mode also checks out the files beside
35 # .github/scripts, which is where TRIAGE_EXEMPTIONS.td and VOUCHED.td live.
36 - name: Checkout trusted scripts
37 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
38 with:
39 ref: ${{ github.event.repository.default_branch }}
40 sparse-checkout: .github/scripts
41
42 - name: Close PRs over the limit
43 uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
44 env:
45 DRY_RUN: ${{ vars.PR_LIMITS_ENFORCE != 'true' }}
46 with:
47 script: |
48 const limits = require("./.github/scripts/pr-limits.cjs");
49 await limits.enforceOpenLimit({ github, context, core, dryRun: process.env.DRY_RUN === "true" });
50
51 sweep:
52 name: Conflict and close windows
53 if: github.event_name != 'pull_request_target'
54 runs-on: ubuntu-24.04
55 concurrency:
56 group: pr-limits-sweep
57 cancel-in-progress: false
58 steps:
59 - name: Checkout trusted scripts
60 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
61 with:
62 ref: ${{ github.event.repository.default_branch }}
63 sparse-checkout: .github/scripts
64
65 - name: Request rebases and close what went unanswered
66 uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
67 env:
68 DRY_RUN: ${{ vars.PR_LIMITS_ENFORCE != 'true' || (github.event_name == 'workflow_dispatch' && inputs.dry_run) }}
69 with:
70 script: |
71 const limits = require("./.github/scripts/pr-limits.cjs");
72 await limits.sweep({ github, context, core, dryRun: process.env.DRY_RUN === "true" });