Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit da5a94e

Browse files
committedNov 5, 2024·
add "skip_check" action type to bcr-pr-reviewer
1 parent 7286206 commit da5a94e

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed
 

‎actions/bcr-pr-reviewer/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ inputs:
77
default: ${{ github.token }}
88

99
action-type:
10-
description: 'The type of action this reviewer should perform, valid values are: notify_maintainers, review_prs, dismiss_approvals'
10+
description: 'The type of action this reviewer should perform, valid values are: notify_maintainers, review_prs, dismiss_approvals, skip_check'
1111
required: true
1212

1313
runs:

‎actions/bcr-pr-reviewer/index.js

+37
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,41 @@ async function runDismissApproval(octokit) {
442442
}
443443
}
444444

445+
const SKIP_CHECK_TRIGGER = "@bazel-io skip_check ";
446+
447+
async function runSkipCheck(octokit) {
448+
const payload = context.payload;
449+
if (!payload.comment.body.startsWith(SKIP_CHECK_TRIGGER)) {
450+
return;
451+
}
452+
const check = payload.comment.body.slice(SKIP_CHECK_TRIGGER.length);
453+
const owner = payload.repository.owner.login;
454+
const repo = payload.repository.name;
455+
if (check == "unstable_url") {
456+
await octokit.rest.issues.addLabels({
457+
owner,
458+
repo,
459+
issue_number: payload.issue.number,
460+
labels: ["skip-url-stability-check"],
461+
});
462+
await octokit.rest.reactions.createForIssueComment({
463+
owner,
464+
repo,
465+
comment_id: payload.comment.id,
466+
content: '+1',
467+
});
468+
} else {
469+
await octokit.rest.reactions.createForIssueComment({
470+
owner,
471+
repo,
472+
comment_id: payload.comment.id,
473+
content: 'confused',
474+
});
475+
console.error(`unknown check: ${check}`);
476+
setFailed(`unknown check: ${check}`);
477+
}
478+
}
479+
445480
async function run() {
446481
const action_type = getInput("action-type");
447482
const token = getInput("token");
@@ -453,6 +488,8 @@ async function run() {
453488
await runPrReviewer(octokit);
454489
} else if (action_type === "dismiss_approvals") {
455490
await runDismissApproval(octokit);
491+
} else if (action_type === "skip_check") {
492+
await runSkipCheck(octokit);
456493
} else {
457494
console.log(`Unknown action type: ${action_type}`);
458495
}

‎actions/release-helper/index.js

-7
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ async function run() {
8181
issue_number: payload.issue.number,
8282
labels: [FLAGGED_LABEL],
8383
});
84-
} else if (command === "unstable_ack" || command.startsWith("unstable_ack ")) {
85-
await octokit.rest.issues.addLabels({
86-
owner,
87-
repo,
88-
issue_number: payload.issue.number,
89-
labels: ["skip-url-stability-check"],
90-
});
9184
} else {
9285
await octokit.rest.reactions.createForIssueComment({
9386
owner,

0 commit comments

Comments
 (0)
Please sign in to comment.