diff --git a/.github/workflows/close-topics.yml b/.github/workflows/close-topics.yml new file mode 100644 index 0000000..02704d9 --- /dev/null +++ b/.github/workflows/close-topics.yml @@ -0,0 +1,44 @@ +name: Close Topics + +on: + # Close Solved closes problem issues with GITHUB_TOKEN, and token-driven + # closes never fire `issues` events — so chain off its run instead. + # Conclusion is not filtered: the script reconciles state, so running after a + # partially successful run is safe and catches whatever it did close. + workflow_run: + workflows: [Close Solved] + types: [completed] + # Covers problem issues closed by hand in the UI. + issues: + types: [closed] + workflow_dispatch: + inputs: + dry_run: + description: Report finished topics without closing anything + type: boolean + default: false + +permissions: + contents: read + issues: write + +concurrency: + group: close-topics + cancel-in-progress: false + +jobs: + close: + # The `issues` trigger fires for every issue in the repo; only closing a + # problem sub-issue can ever complete a topic's core set. + if: github.event_name != 'issues' || contains(github.event.issue.labels.*.name, 'problem') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v2 + + # No install step: the script only uses Bun builtins + fetch. + - run: bun scripts/close-topics.ts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DRY_RUN: ${{ inputs.dry_run }}