diff --git a/.github/scripts/triage/check-changes-ownership.ts b/.github/scripts/triage/check-changes-ownership.ts index ddd4fe3f76..fae914db57 100644 --- a/.github/scripts/triage/check-changes-ownership.ts +++ b/.github/scripts/triage/check-changes-ownership.ts @@ -8,17 +8,23 @@ const prNumber: number = +process.env.PR_NUMBER!; const changes: string[] = process.env.CHANGED_FILES!.split(','); /** - * Checks if the PR already has the 'triage:accepted:ready' label, meaning the triage checks should be skipped. - * @returns true if the PR has the 'triage:accepted:ready' assigned to it, false otherwise. + * Checks if the PR already has the 'triage:accepted:ready' or 'triage:accepted:ready-with-sig' label, meaning the triage checks should be skipped. + * Also checks if the PR title starts with '[chore]' which indicates a maintenance PR that should skip checks. + * @returns true if the PR has the 'triage:accepted:ready' or 'triage:accepted:ready-with-sig' label or title starts with '[chore]', false otherwise. */ async function shouldSkipCheck() { - const result = await octokit.request("GET /repos/{owner}/{repo}/issues/{issue_number}/labels", { + const result = await octokit.request("GET /repos/{owner}/{repo}/issues/{issue_number}", { owner: owner, repo: repo, issue_number: prNumber }); - return result.data.some(l => l.name === "triage:accepted:ready"); + const hasAcceptedLabel = result.data.labels?.some(l => + l.name === "triage:accepted:ready" || l.name === "triage:accepted:ready-with-sig" + ) ?? false; + const isChore = result.data.title.toLowerCase().startsWith('[chore]'); + + return hasAcceptedLabel || isChore; } function getCommentText(changesWithoutOwners: string[]): string { diff --git a/.github/workflows/check-changes-ownership.yml b/.github/workflows/check-changes-ownership.yml index 1529f33bc4..4b851787ce 100644 --- a/.github/workflows/check-changes-ownership.yml +++ b/.github/workflows/check-changes-ownership.yml @@ -1,7 +1,7 @@ name: 'Check changes ownership' on: pull_request_target: - types: [opened, synchronize] + types: [opened, synchronize, edited, labeled, unlabeled] branches: [ 'main' ] paths: - 'model/**'