name: "Issue Sweep"

on:
  schedule:
    - cron: "0 10,22 * * *"
  workflow_dispatch:

permissions:
  issues: write

concurrency:
  group: daily-issue-sweep

jobs:
  sweep:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Bun
        uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 (sha-pinned)
        with:
          bun-version: latest

      - name: Enforce lifecycle timeouts
        run: bun run scripts/sweep.ts
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
          GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}
