diff --git a/scripts/issue-lifecycle/config.ts b/scripts/issue-lifecycle/config.ts index 6a0c00684..8e77c3efa 100644 --- a/scripts/issue-lifecycle/config.ts +++ b/scripts/issue-lifecycle/config.ts @@ -51,6 +51,11 @@ This isn't a judgment of the issue's merit — just routine triage. @${author}, — *Automated.*`, + NEW_ISSUE_NOT_APPROVED: (author: string): string => + `Hi @${author}, thanks for opening this issue. It hasn't been approved by a maintainer yet — we'll get back to you shortly to either milestone it (approval) or close it. + +— *Automated. See [CONTRIBUTING.md](https://github.com/${REPO.owner}/${REPO.repo}/blob/main/CONTRIBUTING.md).*`, + UNASSIGNED_NO_MILESTONE: (assignees: string[]): string => `${assignees.map((u) => "@" + u).join(", ")} — you've been unassigned from this issue automatically because it doesn't have a milestone set. diff --git a/scripts/issue-lifecycle/events.ts b/scripts/issue-lifecycle/events.ts index 2ec75c5cc..c05b29d9c 100644 --- a/scripts/issue-lifecycle/events.ts +++ b/scripts/issue-lifecycle/events.ts @@ -1,4 +1,5 @@ import type { Octokit } from "@octokit/rest"; +import { COMMENTS } from "./config"; import { type Action, applyActions, describeAction, getIssue } from "./github"; import { syncApprovalLabel } from "./rules/approval-label-sync"; import { enforceAssignmentInvariant } from "./rules/assignment-invariant"; @@ -55,6 +56,18 @@ export async function runEvent( }); } + if (eventName === "opened" && issue.milestone === null) { + buckets.push({ + rule: "new-issue-greeting", + actions: [ + { + type: "comment", + body: COMMENTS.NEW_ISSUE_NOT_APPROVED(issue.user?.login ?? "there"), + }, + ], + }); + } + let acted = false; for (const { rule, actions } of buckets) { if (actions.length === 0) continue;