@@ -41,68 +41,95 @@ jobs:
41
41
id : npm-ci-test
42
42
run : npm run ci-test
43
43
44
- run-action-tests :
45
- name : Test Action
44
+ run-action-tests-json :
45
+ name : Test Action with JSON vars
46
46
runs-on : ubuntu-latest
47
47
steps :
48
48
- name : Checkout
49
49
uses : actions/checkout@v4
50
50
51
- - name : Direct Text (JSON Variables)
52
- id : direct-json
51
+ - name : Template Text
52
+ id : template-text
53
53
uses : ./
54
54
with :
55
- template-text : ' Hello {{ login }}, nice to meet you!'
56
- template-vars : >
55
+ template-text :
56
+ ' Hello {{ login }}, nice to meet you {{ person.role }}!'
57
+ template-vars : |
57
58
{
58
- "login": "Octobi Wan Catnobi"
59
+ "login": "Octobi Wan Catnobi",
60
+ "person": { "role": "Master Jedi" }
59
61
}
60
62
61
- - name : Verify Direct Text JSON Output
63
+ - name : Verify Template Text Output
62
64
env :
63
- UPDATED_TEXT : ${{ steps.direct-json .outputs.updated-text }}
65
+ UPDATED_TEXT : ${{ steps.template-text .outputs.updated-text }}
64
66
run : |
65
67
echo "$UPDATED_TEXT" | grep -q "Octobi Wan Catnobi" || exit 1
68
+ echo "$UPDATED_TEXT" | grep -q "Master Jedi" || exit 1
66
69
67
- - name : Direct Text (ENV Variables)
68
- id : direct-env
70
+ - name : Template File
71
+ id : template-file
69
72
uses : ./
70
73
with :
71
- template-text : ' Hello {{ login }}, nice to meet you! '
74
+ template-file : ./__tests__/sample-template.md
72
75
template-vars : |
73
- login=Octoclark Kentocat
76
+ {
77
+ "name": "Spidertocat",
78
+ "person": { "name": "Spider Person" },
79
+ "multiline_paragraph": "This is a multiline\nparagraph example."
80
+ }
74
81
75
- - name : Verify Direct Text ENV Output
82
+ - name : Verify Text File JSON Output
76
83
env :
77
- UPDATED_TEXT : ${{ steps.direct-env .outputs.updated-text }}
84
+ UPDATED_TEXT : ${{ steps.template-file .outputs.updated-text }}
78
85
run : |
79
- echo "$UPDATED_TEXT" | grep -q "Octoclark Kentocat" || exit 1
86
+ echo "$UPDATED_TEXT" | grep -q "Spidertocat" || exit 1
87
+ echo "$UPDATED_TEXT" | grep -q "Spider Person" || exit 1
88
+ echo "$UPDATED_TEXT" | grep -q "This is a multiline" || exit 1
89
+ echo "$UPDATED_TEXT" | grep -q "paragraph example." || exit 1
80
90
81
- - name : Text File (JSON variables)
82
- id : template-file-json
91
+ run-action-tests-yaml :
92
+ name : Test Action with YAML vars
93
+ runs-on : ubuntu-latest
94
+ steps :
95
+ - name : Checkout
96
+ uses : actions/checkout@v4
97
+
98
+ - name : Template Text
99
+ id : template-text
83
100
uses : ./
84
101
with :
85
- template-file : ./examples/hello.md
86
- template-vars : >
87
- {
88
- "login": "Spidertocat"
89
- }
102
+ template-text :
103
+ ' Hello {{ login }}, nice to meet you {{ person.role }}!'
104
+ template-vars : |
105
+ login: Octoclark Kentocat
106
+ person:
107
+ role: Librarian
90
108
91
- - name : Verify Text File JSON Output
109
+ - name : Verify Template Text Output
92
110
env :
93
- UPDATED_TEXT : ${{ steps.template-file-json .outputs.updated-text }}
111
+ UPDATED_TEXT : ${{ steps.template-text .outputs.updated-text }}
94
112
run : |
95
- echo "$UPDATED_TEXT" | grep -q "Spidertocat" || exit 1
113
+ echo "$UPDATED_TEXT" | grep -q "Octoclark Kentocat" || exit 1
114
+ echo "$UPDATED_TEXT" | grep -q "Librarian" || exit 1
96
115
97
- - name : Text File (ENV variables)
98
- id : template-file-env
116
+ - name : Template File
117
+ id : template-file
99
118
uses : ./
100
119
with :
101
- template-file : ./examples/hello.md
102
- template-vars : login=Codercat
103
-
104
- - name : Verify Text File ENV Output
120
+ template-file : ./__tests__/sample-template.md
121
+ template-vars : |
122
+ name: Codercat
123
+ person:
124
+ name: Coder Person
125
+ multiline_paragraph: |
126
+ This is a yaml multiline
127
+ paragraph example.
128
+
129
+ - name : Verify Template File Output
105
130
env :
106
- UPDATED_TEXT : ${{ steps.template-file-env .outputs.updated-text }}
131
+ UPDATED_TEXT : ${{ steps.template-file.outputs.updated-text }}
107
132
run : |
108
133
echo "$UPDATED_TEXT" | grep -q "Codercat" || exit 1
134
+ echo "$UPDATED_TEXT" | grep -q "This is a yaml multiline" || exit 1
135
+ echo "$UPDATED_TEXT" | grep -q "paragraph example." || exit 1
0 commit comments