This repository was archived by the owner on Sep 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ func parseWorkflowVariables(
353353 return nil , err
354354 }
355355
356- re := regexp .MustCompile (`\$\{\s*workflow\.var\.(\w +)\s*\ }` )
356+ re := regexp .MustCompile (`\$\{\s*workflow\.var\.([-\w] +)\s*}` )
357357 replaced := re .ReplaceAllFunc (bs , func (s []byte ) []byte {
358358 name := re .FindSubmatch (s )[1 ]
359359 name = bytes .TrimSpace (name )
Original file line number Diff line number Diff line change @@ -34,6 +34,41 @@ func TestParseParams(t *testing.T) {
3434 },
3535 wantError : false ,
3636 },
37+ {
38+ attributes : map [string ]any {
39+ "description" : "${workflow.var.var-1}" ,
40+ },
41+ params : map [string ]string {
42+ "var-1" : "aaa" ,
43+ },
44+ config : types.WorkflowVariables {
45+ {
46+ Name : "var-1" ,
47+ Value : "alice" ,
48+ Overwrite : true ,
49+ },
50+ },
51+ expected : map [string ]any {
52+ "description" : "aaa" ,
53+ },
54+ wantError : false ,
55+ },
56+ {
57+ attributes : map [string ]any {
58+ "description" : "${workflow.var.var-1}" ,
59+ },
60+ config : types.WorkflowVariables {
61+ {
62+ Name : "var-1" ,
63+ Value : "alice" ,
64+ Overwrite : false ,
65+ },
66+ },
67+ expected : map [string ]any {
68+ "description" : "alice" ,
69+ },
70+ wantError : false ,
71+ },
3772 {
3873 attributes : map [string ]any {
3974 "deepAttr" : map [string ]any {
You can’t perform that action at this time.
0 commit comments