Skip to content

Commit

Permalink
feat(enterprise): add baseBranch trigger filters
Browse files Browse the repository at this point in the history
  • Loading branch information
thsig committed Mar 8, 2021
1 parent 02fb26e commit f0ecf9c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 32 deletions.
40 changes: 18 additions & 22 deletions core/src/config/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ export interface TriggerSpec {
namespace?: string
events?: string[]
branches?: string[]
tags?: string[]
baseBranches?: string[]
ignoreBranches?: string[]
ignoreTags?: string[]
ignoreBaseBranches?: string[]
}

export const triggerSchema = () => {
Expand Down Expand Up @@ -282,26 +282,22 @@ export const triggerSchema = () => {
\n
`
),
branches: joi
.array()
.items(joi.string())
.unique()
.description("If specified, only run the workflow for branches matching one of these filters."),
tags: joi
.array()
.items(joi.string())
.unique()
.description("If specified, only run the workflow for tags matching one of these filters."),
ignoreBranches: joi
.array()
.items(joi.string())
.unique()
.description("If specified, do not run the workflow for branches matching one of these filters."),
ignoreTags: joi
.array()
.items(joi.string())
.unique()
.description("If specified, do not run the workflow for tags matching one of these filters."),
branches: joi.array().items(joi.string()).unique().description(deline`
If specified, only run the workflow for branches matching one of these filters. These filters refer to the
pull/merge request's head branch (e.g. \`my-feature-branch\`), not the base branch that the pull/merge request
would be merged into if approved (e.g. \`main\`).
`),
baseBranches: joi.array().items(joi.string()).unique().description(deline`
If specified, only run the workflow for pull/merge requests whose base branch matches one of these filters.
`),
ignoreBranches: joi.array().items(joi.string()).unique().description(deline`
If specified, do not run the workflow for branches matching one of these filters. These filters refer to the
pull/merge request's head branch (e.g. \`my-feature-branch\`), not the base branch that the pull/merge request
would be merged into if approved (e.g. \`main\`).
`),
ignoreBaseBranches: joi.array().items(joi.string()).unique().description(deline`
If specified, do not run the workflow for pull/merge requests whose base branch matches one of these filters.
`),
})
}

Expand Down
10 changes: 0 additions & 10 deletions core/test/unit/src/config/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ describe("resolveWorkflowConfig", () => {
events: ["pull-request"],
branches: ["feature*"],
ignoreBranches: ["feature-ignored*"],
tags: ["v1*"],
ignoreTags: ["v1-ignored*"],
},
],
}
Expand Down Expand Up @@ -196,8 +194,6 @@ describe("resolveWorkflowConfig", () => {
events: ["pull-request"],
branches: ["feature*"],
ignoreBranches: ["feature-ignored*"],
tags: ["v1*"],
ignoreTags: ["v1-ignored*"],
},
],
}
Expand All @@ -223,8 +219,6 @@ describe("resolveWorkflowConfig", () => {
events: ["pull-request"],
branches: ["feature*"],
ignoreBranches: ["feature-ignored*"],
tags: ["v1*"],
ignoreTags: ["v1-ignored*"],
},
],
}
Expand All @@ -250,8 +244,6 @@ describe("resolveWorkflowConfig", () => {
events: ["pull-request"],
branches: ["feature*"],
ignoreBranches: ["feature-ignored*"],
tags: ["v1*"],
ignoreTags: ["v1-ignored*"],
},
],
}
Expand All @@ -268,8 +260,6 @@ describe("resolveWorkflowConfig", () => {
events: ["pull-request"],
branches: ["feature*"],
ignoreBranches: ["feature-ignored*"],
tags: ["v1*"],
ignoreTags: ["v1-ignored*"],
}
const config: WorkflowConfig = {
...defaults,
Expand Down

0 comments on commit f0ecf9c

Please sign in to comment.