Skip to content

Commit 85a1288

Browse files
lmolkovabachgarash
authored andcommitted
[chore] Exclude chore PRs from ownership checks, trigger checks on edits and labeling (open-telemetry#3109)
1 parent 77fa618 commit 85a1288

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

.github/scripts/triage/check-changes-ownership.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,23 @@ const prNumber: number = +process.env.PR_NUMBER!;
88
const changes: string[] = process.env.CHANGED_FILES!.split(',');
99

1010
/**
11-
* Checks if the PR already has the 'triage:accepted:ready' label, meaning the triage checks should be skipped.
12-
* @returns true if the PR has the 'triage:accepted:ready' assigned to it, false otherwise.
11+
* Checks if the PR already has the 'triage:accepted:ready' or 'triage:accepted:ready-with-sig' label, meaning the triage checks should be skipped.
12+
* Also checks if the PR title starts with '[chore]' which indicates a maintenance PR that should skip checks.
13+
* @returns true if the PR has the 'triage:accepted:ready' or 'triage:accepted:ready-with-sig' label or title starts with '[chore]', false otherwise.
1314
*/
1415
async function shouldSkipCheck() {
15-
const result = await octokit.request("GET /repos/{owner}/{repo}/issues/{issue_number}/labels", {
16+
const result = await octokit.request("GET /repos/{owner}/{repo}/issues/{issue_number}", {
1617
owner: owner,
1718
repo: repo,
1819
issue_number: prNumber
1920
});
2021

21-
return result.data.some(l => l.name === "triage:accepted:ready");
22+
const hasAcceptedLabel = result.data.labels?.some(l =>
23+
l.name === "triage:accepted:ready" || l.name === "triage:accepted:ready-with-sig"
24+
) ?? false;
25+
const isChore = result.data.title.toLowerCase().startsWith('[chore]');
26+
27+
return hasAcceptedLabel || isChore;
2228
}
2329

2430
function getCommentText(changesWithoutOwners: string[]): string {

.github/workflows/check-changes-ownership.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: 'Check changes ownership'
22
on:
33
pull_request_target:
4-
types: [opened, synchronize]
4+
types: [opened, synchronize, edited, labeled, unlabeled]
55
branches: [ 'main' ]
66
paths:
77
- 'model/**'

0 commit comments

Comments
 (0)