Fix for numerical branch names
This commit is contained in:
parent
9f7bdecc04
commit
2d00e8c6f7
6 changed files with 60 additions and 2 deletions
|
|
@ -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, []);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ function escapeRegExp(string) {
|
|||
function patternToRegExp(value) {
|
||||
return new RegExp(
|
||||
`^${value
|
||||
.toString()
|
||||
.split(GLOB_PATTERN)
|
||||
.reduce(function (arr, cur) {
|
||||
if (cur === "**") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue