name: Issue claims # Contributors claim issues with /assign-me and release them with /unassign-me; # maintainers use /assign @user and /unassign @user. A daily sweep releases claims # with no code word reply after two days, reminds people whose claim has gone quiet # and releases it after a week. New and edited comments from assignees also run # it, so the bot can confirm a code word reply or say what's missing. The rules # live in scripts/issue-claims.mjs and are tested in # tests/scripts/issue-claims.test.ts. See #1669. on: issue_comment: types: [created, edited] schedule: - cron: "17 6 * * *" workflow_dispatch: inputs: dry_run: description: Log what the sweep would do without commenting or unassigning type: boolean default: true permissions: {} jobs: command: # Comments on PRs also arrive as issue_comment; only issues are claimable. # Commands come from anyone; other comments only matter from an assignee. if: >- github.repository == 'OWASP/cve-lite-cli' && github.event_name == 'issue_comment' && !github.event.issue.pull_request && (contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/unassign') || contains(github.event.issue.assignees.*.login, github.event.comment.user.login)) runs-on: ubuntu-latest permissions: contents: read issues: write pull-requests: read # No concurrency group: GitHub would cancel queued commands in a burst. The # script re-reads the issue and checks the assignees after assigning instead. timeout-minutes: 5 steps: # The default branch, never a PR's code: issue_comment always runs from main. - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: persist-credentials: false - name: Handle claim command or code word reply uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const { handleComment } = await import(`${process.env.GITHUB_WORKSPACE}/scripts/issue-claims.mjs`); await handleComment({ github, context, core }); sweep: if: github.repository == 'OWASP/cve-lite-cli' && github.event_name != 'issue_comment' runs-on: ubuntu-latest permissions: contents: read issues: write pull-requests: read concurrency: group: issue-claims-sweep cancel-in-progress: false timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: ref: ${{ github.event.repository.default_branch }} persist-credentials: false - name: Release unproven claims, remind and release quiet ones uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }} with: script: | const { sweepClaims } = await import(`${process.env.GITHUB_WORKSPACE}/scripts/issue-claims.mjs`); await sweepClaims({ github, context, core, dryRun: process.env.DRY_RUN === 'true' });