Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow skip-check label on PRs to main #309

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
28 changes: 13 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -215,6 +215,19 @@ const probotHandler: ApplicationFunction = async (robot, { getRouter }) => {
checkRun = response.data;
}

// Allow the PR to skip backport label checking if it has the SKIP_CHECK_LABEL.
if (await labelExistsOnPR(context, pr.number, SKIP_CHECK_LABEL)) {
robot.log(
`#${pr.number} is labeled with ${SKIP_CHECK_LABEL} - skipping backport validation check`,
);
await updateBackportValidityCheck(context, checkRun, {
title: 'Backport Check Skipped',
summary: 'This PR is not a backport - skip backport validation check',
conclusion: CheckRunStatus.NEUTRAL,
});
return;
}

if (pr.base.ref !== pr.base.repo.default_branch) {
// Ensure that we aren't including our own base branch in the backport process.
if (action === 'labeled') {
@@ -232,21 +245,6 @@ const probotHandler: ApplicationFunction = async (robot, { getRouter }) => {
}
}

// If a branch is targeting something that isn't main it might not be a backport;
// allow for a label to skip backport validity check for these branches.
if (await labelExistsOnPR(context, pr.number, SKIP_CHECK_LABEL)) {
robot.log(
`#${pr.number} is labeled with ${SKIP_CHECK_LABEL} - skipping backport validation check`,
);
await updateBackportValidityCheck(context, checkRun, {
title: 'Backport Check Skipped',
summary:
'This PR is not a backport - skip backport validation check',
conclusion: CheckRunStatus.NEUTRAL,
});
return;
}

const FASTTRACK_PREFIXES = ['build:', 'ci:'];
const FASTTRACK_USERS = [
getEnvVar('BOT_USER_NAME'),