Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #346 from github/simon-engledew/fix-numerical-bran…
…ches

Fix for numerical branch names
Simon Engledew authored and GitHub committed Dec 21, 2020
2 parents 9f7bdec + 2d00e8c commit dc999c5
Showing 6 changed files with 60 additions and 2 deletions.
1 change: 1 addition & 0 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.

24 changes: 24 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.

32 changes: 32 additions & 0 deletions src/actions-util.test.ts
@@ -1,4 +1,5 @@
import test from "ava";
import * as yaml from "js-yaml";
import sinon from "sinon";

import * as actionsutil from "./actions-util";
@@ -400,3 +401,34 @@ test("patternIsSuperset()", (t) => {
)
);
});

test("validateWorkflow() when branches contain dots", (t) => {
const errors = actionsutil.validateWorkflow(
yaml.safeLoad(`
on:
push:
branches: [4.1, master]
pull_request:
# The branches below must be a subset of the branches above
branches: [4.1, master]
`)
);

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

test("validateWorkflow() when on.push has a trailing comma", (t) => {
const errors = actionsutil.validateWorkflow(
yaml.safeLoad(`
name: "CodeQL"
on:
push:
branches: [master, ]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
`)
);

t.deepEqual(errors, []);
});
1 change: 1 addition & 0 deletions src/actions-util.ts
@@ -143,6 +143,7 @@ function escapeRegExp(string) {
function patternToRegExp(value) {
return new RegExp(
`^${value
.toString()
.split(GLOB_PATTERN)
.reduce(function (arr, cur) {
if (cur === "**") {

0 comments on commit dc999c5

Please sign in to comment.