Skip to content

Commit

Permalink
fix: allow skip-check label on PRs to main
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Sep 23, 2024
1 parent c8c9cf4 commit b4d63c3
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,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') {
Expand All @@ -227,21 +240,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'),
Expand Down

0 comments on commit b4d63c3

Please sign in to comment.