Update source
This commit is contained in:
parent
cb3b3a8cb5
commit
c06dcf8fa2
3 changed files with 17 additions and 3 deletions
12
lib/actions-util.js
generated
12
lib/actions-util.js
generated
|
|
@ -127,6 +127,11 @@ function validateWorkflow(doc) {
|
|||
// .jobs[key].steps[].run
|
||||
for (const job of Object.values(((_a = doc) === null || _a === void 0 ? void 0 : _a.jobs) || {})) {
|
||||
for (const step of ((_b = job) === null || _b === void 0 ? void 0 : _b.steps) || []) {
|
||||
// this was advice that we used to give in the README
|
||||
// we actually want to run the analysis on the merge commit
|
||||
// to produce results that are more inline with expectations
|
||||
// (i.e: this is what will happen if you merge this PR)
|
||||
// and avoid some race conditions
|
||||
if (((_c = step) === null || _c === void 0 ? void 0 : _c.run) === "git checkout HEAD^2") {
|
||||
errors.push(exports.WorkflowErrors.CheckoutWrongHead);
|
||||
}
|
||||
|
|
@ -167,6 +172,9 @@ function validateWorkflow(doc) {
|
|||
else {
|
||||
const paths = (_d = doc.on.push) === null || _d === void 0 ? void 0 : _d.paths;
|
||||
if (Array.isArray(paths) && paths.length > 0) {
|
||||
// if you specify paths you can end up with commits that have no baseline
|
||||
// if they didn't change any files
|
||||
// currently we cannot go back through the history and find the most recent baseline
|
||||
errors.push(exports.WorkflowErrors.PathsSpecified);
|
||||
}
|
||||
}
|
||||
|
|
@ -176,10 +184,14 @@ function validateWorkflow(doc) {
|
|||
const pull_request = doc.on.pull_request.branches || [];
|
||||
const intersects = pull_request.filter((value) => !push.includes(value));
|
||||
if (intersects.length > 0) {
|
||||
// there are branches in pull_request that may not have a baseline
|
||||
// because we are not building them on push
|
||||
errors.push(exports.WorkflowErrors.MismatchedBranches);
|
||||
}
|
||||
}
|
||||
else if (push.length > 0) {
|
||||
// push is set up to run on a subset of branches
|
||||
// and you could open a PR against a branch with no baseline
|
||||
errors.push(exports.WorkflowErrors.MismatchedBranches);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -207,8 +207,9 @@ export function validateWorkflow(doc: Workflow): CodedError[] {
|
|||
} else {
|
||||
const paths = doc.on.push?.paths;
|
||||
if (Array.isArray(paths) && paths.length > 0) {
|
||||
// you can end up with commits that have no baseline if they didn't change any files
|
||||
// at the moment we cannot go back through the history and find the most recent baseline
|
||||
// if you specify paths you can end up with commits that have no baseline
|
||||
// if they didn't change any files
|
||||
// currently we cannot go back through the history and find the most recent baseline
|
||||
errors.push(WorkflowErrors.PathsSpecified);
|
||||
}
|
||||
}
|
||||
|
|
@ -223,6 +224,7 @@ export function validateWorkflow(doc: Workflow): CodedError[] {
|
|||
);
|
||||
if (intersects.length > 0) {
|
||||
// there are branches in pull_request that may not have a baseline
|
||||
// because we are not building them on push
|
||||
errors.push(WorkflowErrors.MismatchedBranches);
|
||||
}
|
||||
} else if (push.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue