GeezerVison is showing github.com — ci: Automate PR cleanup (#27667) · anotheroni/opencode@d59d996
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +50Lines changed: 50 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +name: close-prs |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 22 * * *" # Daily at 10:00 PM UTC |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + dry-run: |
| 9 | + description: "Log matching PRs without closing them" |
| 10 | + type: boolean |
| 11 | + default: true |
| 12 | + max-close: |
| 13 | + description: "Maximum matching PRs to close" |
| 14 | + type: string |
| 15 | + required: false |
| 16 | + default: "50" |
| 17 | + |
| 18 | +jobs: |
| 19 | + close: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + timeout-minutes: 240 |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + issues: write |
| 25 | + pull-requests: write |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 |
| 28 | + |
| 29 | + - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 |
| 30 | + with: |
| 31 | + bun-version: latest |
| 32 | + |
| 33 | + - name: Close old PRs without enough positive reactions |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ github.token }} |
| 36 | + run: | |
| 37 | + max_close="${{ inputs['max-close'] }}" |
| 38 | + if [ -z "$max_close" ]; then |
| 39 | + max_close="50" |
| 40 | + fi |
| 41 | +
|
| 42 | + args=("--threshold" "2" "--age-months" "1" "--sleep-ms" "20000" "--max-close" "$max_close") |
| 43 | +
|
| 44 | + if [ "${{ github.event_name }}" = "schedule" ]; then |
| 45 | + args+=("--execute") |
| 46 | + elif [ "${{ inputs['dry-run'] }}" = "false" ]; then |
| 47 | + args+=("--execute") |
| 48 | + fi |
| 49 | +
|
| 50 | + bun script/github/close-prs.ts "${args[@]}" |
Collapse file
Copy file name to clipboardExpand all lines: .github/workflows/close-stale-prs.yml -235Lines changed: 0 additions & 235 deletions