Skip to content

Commit aedaf8e

Browse files
committed
Preserve behavior where we ignore 'version' in the workflow spec
1 parent b207b48 commit aedaf8e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/lib/utils/tests/test_workflow.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ def test_duplicate_workflow_raises(self):
8181
workflow_utils.parse_workflow_spec(spec)
8282
self.assertIn('workflow', str(context.exception))
8383

84+
def test_version_key_allowed(self):
85+
spec = """\
86+
version: 2
87+
workflow:
88+
name: my-wf
89+
groups: []
90+
"""
91+
workflow_spec, default_values = workflow_utils.parse_workflow_spec(spec)
92+
self.assertIn('name: my-wf', workflow_spec)
93+
self.assertIsNone(default_values)
94+
8495
def test_unknown_top_level_key_raises(self):
8596
spec = """\
8697
workflow:

src/lib/utils/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def parse_workflow_spec(workflow_spec: str) -> Tuple[str, Dict | None]:
4545
r'^([a-zA-Z][a-zA-Z0-9_-]*):(.*?)(?=^[a-zA-Z][a-zA-Z0-9_-]*:|\Z)',
4646
re.DOTALL | re.MULTILINE,
4747
)
48-
allowed_sections = {'workflow', 'default-values'}
48+
allowed_sections = {'workflow', 'default-values', 'version'}
4949
sections: Dict[str, str] = {}
5050
for match in section_pattern.finditer(workflow_spec):
5151
key = match.group(1)

0 commit comments

Comments
 (0)