close-prs.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. name: close-prs
  2. on:
  3. schedule:
  4. - cron: "0 22 * * *" # Daily at 10:00 PM UTC
  5. workflow_dispatch:
  6. inputs:
  7. dry-run:
  8. description: "Log matching PRs without closing them"
  9. type: boolean
  10. default: true
  11. max-close:
  12. description: "Maximum matching PRs to close"
  13. type: string
  14. required: false
  15. default: "50"
  16. jobs:
  17. close:
  18. runs-on: ubuntu-latest
  19. timeout-minutes: 240
  20. permissions:
  21. contents: read
  22. issues: write
  23. pull-requests: write
  24. steps:
  25. - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
  26. - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
  27. with:
  28. bun-version: latest
  29. - name: Close old PRs without enough positive reactions
  30. env:
  31. GITHUB_TOKEN: ${{ github.token }}
  32. run: |
  33. max_close="${{ inputs['max-close'] }}"
  34. if [ -z "$max_close" ]; then
  35. max_close="50"
  36. fi
  37. args=("--threshold" "2" "--age-months" "1" "--sleep-ms" "20000" "--max-close" "$max_close")
  38. if [ "${{ github.event_name }}" = "schedule" ]; then
  39. args+=("--execute")
  40. elif [ "${{ inputs['dry-run'] }}" = "false" ]; then
  41. args+=("--execute")
  42. fi
  43. bun script/github/close-prs.ts "${args[@]}"