Implement feedback
This commit is contained in:
parent
eed314143b
commit
be09fb3e99
9 changed files with 27 additions and 32 deletions
16
lib/actions-util.js
generated
16
lib/actions-util.js
generated
|
|
@ -187,8 +187,8 @@ function validateWorkflow(doc) {
|
|||
const push = doc.on.push.branches || [];
|
||||
if (doc.on.pull_request) {
|
||||
const pull_request = doc.on.pull_request.branches || [];
|
||||
const intersects = pull_request.filter((value) => !push.includes(value));
|
||||
if (intersects.length > 0) {
|
||||
const difference = pull_request.filter((value) => !push.includes(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
|
||||
errors.push(exports.WorkflowErrors.MismatchedBranches);
|
||||
|
|
@ -218,23 +218,19 @@ exports.validateWorkflow = validateWorkflow;
|
|||
async function getWorkflowErrors() {
|
||||
const workflow = await getWorkflow();
|
||||
if (workflow === undefined) {
|
||||
return undefined;
|
||||
return [];
|
||||
}
|
||||
const workflowErrors = validateWorkflow(workflow);
|
||||
if (workflowErrors.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return workflowErrors;
|
||||
return validateWorkflow(workflow);
|
||||
}
|
||||
exports.getWorkflowErrors = getWorkflowErrors;
|
||||
function formatWorkflowErrors(errors) {
|
||||
const issuesWere = errors.length === 1 ? "issue was" : "issues were";
|
||||
const errorsList = errors.map((e) => e.message).join(", ");
|
||||
const errorsList = errors.map((e) => e.message).join(" ");
|
||||
return `${errors.length} ${issuesWere} detected with this workflow: ${errorsList}`;
|
||||
}
|
||||
exports.formatWorkflowErrors = formatWorkflowErrors;
|
||||
function formatWorkflowCause(errors) {
|
||||
if (errors === undefined) {
|
||||
if (errors.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return errors.map((e) => e.code).join(",");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue