Skip to content

Commit

Permalink
Remove check on branch prefix when not a subbranch (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippeauriach committed Sep 20, 2023
1 parent cfb8a0e commit 941be0d
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions lib/actions/pullRequest.js
Expand Up @@ -47,36 +47,6 @@ exports.validatePR = async function validatePR({ pullRequest, issue }) {
);
}

const branches = await octokit.paginate(
"GET /repos/{owner}/{repo}/branches",
{ owner, repo }
);
let oneBranchIsOk = false;
let nokBranch;
for (const { name: branchName } of branches) {
if (headRef === branchName) {
continue;
}
const prefix = headRef.substr(0, branchName.length);
const postfix = headRef.substr(branchName.length);
if (prefix === branchName && prefix.length === branchName.length) {
if (postfix.match(/^--[a-z]/)) {
oneBranchIsOk = true;
console.log(`Found OK branch: “${branchName}” matches “${headRef}”`);
} else {
nokBranch = branchName;
console.log(
`Found NOK branch: “${branchName}” does not match “${headRef}”`
);
}
}
}
if (!oneBranchIsOk && nokBranch) {
throw new Error(
`This pull request is based on the branch “${headRef}”, which starts like “${nokBranch}”. Use double dashes (“--”) to separate sub-branches. See https://app.gitbook.com/@mobsuccess/s/mobsuccess/git`
);
}

if (
commits === 1 &&
!title.match(/^Revert ".*"/) &&
Expand Down

0 comments on commit 941be0d

Please sign in to comment.