beads/.github/workflows/remove-needs-info.yml
Julian Knutsen 403e27c6de
ci: add needs-triage inbox labeling (mirrors gastownhall/gascity) (#6622)
Beads has had no intake labeling: 829 open issues and 388 open PRs carry no
kind/priority/status label, so the hourly PM triage patrol (Sarah, ADR-006),
which only fetches status/needs-triage items, has processed a single item
since 2026-07-17.

Adds the five gascity workflows with the bot login swapped to
gascityinc-sarah[bot]:
- triage-label: add status/needs-triage on issue/PR open, reopen, ready_for_review (skips drafts)
- remove-needs-triage: drop the inbox label when a non-status label is applied by anyone but the PM App
- request-needs-info / remove-needs-info / close-stale-needs: the needs-info / needs-repro lifecycle the triage framework emits

Existing open items are not relabeled by this change; a one-off backfill is a
separate, explicit step.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-19 14:37:19 -07:00

65 lines
2.4 KiB
YAML

name: Remove needs-info on author response
on:
issue_comment:
types: [created]
pull_request_target:
types: [synchronize]
permissions: {}
jobs:
# pull_request_target is safe here because this job never checks out or runs
# pull request code; it only removes labels from the issue/PR metadata.
remove-label:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Remove needs-info / needs-repro on author response
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const labels = ['status/needs-info', 'status/needs-repro'];
let number, author;
if (context.eventName === 'issue_comment') {
number = context.payload.issue.number;
author = context.payload.issue.user.login;
if (context.payload.comment.user.login !== author) return;
} else {
number = context.payload.pull_request.number;
author = context.payload.pull_request.user.login;
if (context.payload.sender.login !== author) return;
}
const current = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: number,
});
const currentNames = current.data.map(l => l.name);
for (const label of labels) {
if (!currentNames.includes(label)) continue;
// Idempotent removal: concurrent triggers can race to remove the
// same label, leaving the loser with a 404 "Label does not
// exist". Treat an already-absent label as success rather than
// failing the job.
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: number,
name: label,
});
console.log(`Removed '${label}' from #${number}`);
} catch (err) {
if (err.status === 404) {
console.log(`'${label}' already absent from #${number} (concurrent removal); nothing to do`);
continue;
}
throw err;
}
}