Skip to content

Commit

Permalink
Showing 6 changed files with 38 additions and 8 deletions.
9 changes: 6 additions & 3 deletions lib/actions-util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/actions-util.js.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions lib/actions-util.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/actions-util.test.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/actions-util.test.ts
@@ -285,6 +285,20 @@ test("validateWorkflow() for a range of malformed workflows", (t) => {
t.deepEqual(actionsutil.validateWorkflow(1 as any), [
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) => {
9 changes: 6 additions & 3 deletions src/actions-util.ts
@@ -168,10 +168,13 @@ function branchesToArray(branches?: string | null | string[]): string[] | "**" {
if (typeof branches === "string") {
return [branches];
}
if (!branches || branches.length === 0) {
return "**";
if (Array.isArray(branches)) {
if (branches.length === 0) {
return "**";
}
return branches;
}
return branches;
return "**";
}

enum MissingTriggers {

0 comments on commit 18c6a7d

Please sign in to comment.