Skip to content

Commit dc999c5

Browse files
author
Simon Engledew
authored
Merge pull request #346 from github/simon-engledew/fix-numerical-branches
Fix for numerical branch names
2 parents 9f7bdec + 2d00e8c commit dc999c5

File tree

6 files changed

+60
-2
lines changed

6 files changed

+60
-2
lines changed

lib/actions-util.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/actions-util.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/actions-util.test.js

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/actions-util.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actions-util.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import test from "ava";
2+
import * as yaml from "js-yaml";
23
import sinon from "sinon";
34

45
import * as actionsutil from "./actions-util";
@@ -400,3 +401,34 @@ test("patternIsSuperset()", (t) => {
400401
)
401402
);
402403
});
404+
405+
test("validateWorkflow() when branches contain dots", (t) => {
406+
const errors = actionsutil.validateWorkflow(
407+
yaml.safeLoad(`
408+
on:
409+
push:
410+
branches: [4.1, master]
411+
pull_request:
412+
# The branches below must be a subset of the branches above
413+
branches: [4.1, master]
414+
`)
415+
);
416+
417+
t.deepEqual(errors, []);
418+
});
419+
420+
test("validateWorkflow() when on.push has a trailing comma", (t) => {
421+
const errors = actionsutil.validateWorkflow(
422+
yaml.safeLoad(`
423+
name: "CodeQL"
424+
on:
425+
push:
426+
branches: [master, ]
427+
pull_request:
428+
# The branches below must be a subset of the branches above
429+
branches: [master]
430+
`)
431+
);
432+
433+
t.deepEqual(errors, []);
434+
});

src/actions-util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ function escapeRegExp(string) {
143143
function patternToRegExp(value) {
144144
return new RegExp(
145145
`^${value
146+
.toString()
146147
.split(GLOB_PATTERN)
147148
.reduce(function (arr, cur) {
148149
if (cur === "**") {

0 commit comments

Comments
 (0)