Skip to content

Commit 8074252

Browse files
committed
Add missing name property to workflow definition
1 parent 5229108 commit 8074252

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@noxify/gitlab-ci-builder": patch
3+
---
4+
5+
Add missing `name` property to `workflow` definition to match GitLab CI specification.

src/types/main.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ interface GitLabCi {
2424
include?: IncludeOutputDefinition[]
2525
variables?: VariablesDefinition
2626
/**
27-
* @see https://docs.gitlab.com/ee/ci/yaml/#workflowrules
27+
* @see https://docs.gitlab.com/ee/ci/yaml/#workflow
2828
*/
2929
workflow?: {
30+
/**
31+
* @see https://docs.gitlab.com/ee/ci/yaml/#workflowname
32+
*/
33+
name?: string
34+
/**
35+
* @see https://docs.gitlab.com/ee/ci/yaml/#workflowrules
36+
*/
3037
rules: RulesDefinition<"always" | "never">
3138
}
3239
/**

tests/workflow.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,15 @@ describe("Config - workflow", () => {
4343
const result = config.workflow({ rules: [] })
4444
expect(result).toBe(config)
4545
})
46+
47+
it("should set workflow name", () => {
48+
config.workflow({
49+
name: "Pipeline for $CI_COMMIT_BRANCH",
50+
rules: [{ if: "$CI_COMMIT_BRANCH", when: "always" }],
51+
})
52+
const result = config.getPlainObject()
53+
54+
expect(result.workflow?.name).toBe("Pipeline for $CI_COMMIT_BRANCH")
55+
expect(result.workflow?.rules).toHaveLength(1)
56+
})
4657
})

0 commit comments

Comments
 (0)