Skip to content

Commit

Permalink
Handle the case where branches may be strings, including "*"
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Engledew committed Dec 1, 2020
1 parent c6dbd5a commit ac1c081
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 13 deletions.
22 changes: 17 additions & 5 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.

12 changes: 12 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

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

16 changes: 16 additions & 0 deletions src/actions-util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,22 @@ test("validateWorkflow() when on.push is a correct object", (t) => {
t.deepEqual(errors.length, 0);
});

test("validateWorkflow() when on.pull_requests is a string", (t) => {
const errors = actionsutil.validateWorkflow({
on: { push: { branches: ["main"] }, pull_request: { branches: "*" } },
});

t.deepEqual(errors, [actionsutil.WorkflowErrors.MismatchedBranches]);
});

test("validateWorkflow() when on.pull_requests is a string and correct", (t) => {
const errors = actionsutil.validateWorkflow({
on: { push: { branches: "*" }, pull_request: { branches: "*" } },
});

t.deepEqual(errors, []);
});

test("validateWorkflow() when on.push is correct with empty objects", (t) => {
const errors = actionsutil.validateWorkflow({
on: { push: undefined, pull_request: undefined },
Expand Down
Loading

0 comments on commit ac1c081

Please sign in to comment.