fix another edge case
This commit is contained in:
parent
1dc40ba165
commit
18c6a7d6d1
6 changed files with 38 additions and 8 deletions
9
lib/actions-util.js
generated
9
lib/actions-util.js
generated
|
|
@ -132,10 +132,13 @@ function branchesToArray(branches) {
|
||||||
if (typeof branches === "string") {
|
if (typeof branches === "string") {
|
||||||
return [branches];
|
return [branches];
|
||||||
}
|
}
|
||||||
if (!branches || branches.length === 0) {
|
if (Array.isArray(branches)) {
|
||||||
return "**";
|
if (branches.length === 0) {
|
||||||
|
return "**";
|
||||||
|
}
|
||||||
|
return branches;
|
||||||
}
|
}
|
||||||
return branches;
|
return "**";
|
||||||
}
|
}
|
||||||
var MissingTriggers;
|
var MissingTriggers;
|
||||||
(function (MissingTriggers) {
|
(function (MissingTriggers) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
10
lib/actions-util.test.js
generated
10
lib/actions-util.test.js
generated
|
|
@ -202,6 +202,16 @@ ava_1.default("validateWorkflow() for a range of malformed workflows", (t) => {
|
||||||
t.deepEqual(actionsutil.validateWorkflow(1), [
|
t.deepEqual(actionsutil.validateWorkflow(1), [
|
||||||
actionsutil.WorkflowErrors.MissingHooks,
|
actionsutil.WorkflowErrors.MissingHooks,
|
||||||
]);
|
]);
|
||||||
|
t.deepEqual(actionsutil.validateWorkflow({
|
||||||
|
on: {
|
||||||
|
push: {
|
||||||
|
branches: 1,
|
||||||
|
},
|
||||||
|
pull_request: {
|
||||||
|
branches: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}), []);
|
||||||
});
|
});
|
||||||
ava_1.default("validateWorkflow() when on.pull_request for every branch but push specifies branches", (t) => {
|
ava_1.default("validateWorkflow() when on.pull_request for every branch but push specifies branches", (t) => {
|
||||||
const errors = actionsutil.validateWorkflow({
|
const errors = actionsutil.validateWorkflow({
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -285,6 +285,20 @@ test("validateWorkflow() for a range of malformed workflows", (t) => {
|
||||||
t.deepEqual(actionsutil.validateWorkflow(1 as any), [
|
t.deepEqual(actionsutil.validateWorkflow(1 as any), [
|
||||||
actionsutil.WorkflowErrors.MissingHooks,
|
actionsutil.WorkflowErrors.MissingHooks,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
t.deepEqual(
|
||||||
|
actionsutil.validateWorkflow({
|
||||||
|
on: {
|
||||||
|
push: {
|
||||||
|
branches: 1,
|
||||||
|
},
|
||||||
|
pull_request: {
|
||||||
|
branches: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as any),
|
||||||
|
[]
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("validateWorkflow() when on.pull_request for every branch but push specifies branches", (t) => {
|
test("validateWorkflow() when on.pull_request for every branch but push specifies branches", (t) => {
|
||||||
|
|
|
||||||
|
|
@ -168,10 +168,13 @@ function branchesToArray(branches?: string | null | string[]): string[] | "**" {
|
||||||
if (typeof branches === "string") {
|
if (typeof branches === "string") {
|
||||||
return [branches];
|
return [branches];
|
||||||
}
|
}
|
||||||
if (!branches || branches.length === 0) {
|
if (Array.isArray(branches)) {
|
||||||
return "**";
|
if (branches.length === 0) {
|
||||||
|
return "**";
|
||||||
|
}
|
||||||
|
return branches;
|
||||||
}
|
}
|
||||||
return branches;
|
return "**";
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MissingTriggers {
|
enum MissingTriggers {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue