Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/scripts/triage/check-changes-ownership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading