First iteration on feedback
This commit is contained in:
parent
56b1ead679
commit
4d862616ce
7 changed files with 50 additions and 41 deletions
10
lib/actions-util.js
generated
10
lib/actions-util.js
generated
|
|
@ -120,7 +120,7 @@ function considerToken(a, b) {
|
|||
return { advance: a === b, consume: a === b };
|
||||
}
|
||||
}
|
||||
function tokensMatch(tokensA, tokensB) {
|
||||
function tokensAreSuperset(tokensA, tokensB) {
|
||||
let indexA = 0;
|
||||
let indexB = 0;
|
||||
let advance;
|
||||
|
|
@ -146,12 +146,12 @@ function tokensMatch(tokensA, tokensB) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
function patternsOverlap(patternA, patternB) {
|
||||
function patternIsSuperset(patternA, patternB) {
|
||||
const tokensA = tokenize(patternA);
|
||||
const tokensB = tokenize(patternB);
|
||||
return tokensMatch(tokensA, tokensB) && tokensMatch(tokensA.reverse(), tokensB.reverse());
|
||||
return tokensAreSuperset(tokensA, tokensB) && tokensAreSuperset(tokensA.reverse(), tokensB.reverse());
|
||||
}
|
||||
exports.patternsOverlap = patternsOverlap;
|
||||
exports.patternIsSuperset = patternIsSuperset;
|
||||
function branchesToArray(branches) {
|
||||
if (typeof branches === "string") {
|
||||
return [branches];
|
||||
|
|
@ -248,7 +248,7 @@ function validateWorkflow(doc) {
|
|||
if (push !== "**") {
|
||||
const pull_request = branchesToArray((_g = doc.on.pull_request) === null || _g === void 0 ? void 0 : _g.branches);
|
||||
if (pull_request !== "**") {
|
||||
const difference = pull_request.filter((value) => !push.some((o) => patternsOverlap(o, value)));
|
||||
const difference = pull_request.filter((value) => !push.some((o) => patternIsSuperset(o, value)));
|
||||
if (difference.length > 0) {
|
||||
// there are branches in pull_request that may not have a baseline
|
||||
// because we are not building them on push
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue