@@ -20,11 +20,11 @@ Install `github-action-utils` using pip:
20
20
pip install github-action-utils
21
21
```
22
22
23
- ## Usage
23
+ ## Available Functions
24
24
25
- This section describes how to use the ` github-action-utils ` package . The functions in the package should be used inside a workflow.
25
+ This section documents all the functions provided by ` github-action-utils ` . The functions in the package should be used inside a workflow run .
26
26
27
- ### ** ` echo ` **
27
+ ### ** ` echo(message) ` **
28
28
29
29
Prints specified message to the action workflow console.
30
30
@@ -39,7 +39,7 @@ Prints specified message to the action workflow console.
39
39
# Hello World
40
40
```
41
41
42
- ### ** ` debug ` **
42
+ ### ** ` debug(message) ` **
43
43
44
44
Prints colorful debug message to the action workflow console.
45
45
GitHub Actions Docs: [ debug] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-debug-message )
@@ -55,7 +55,7 @@ GitHub Actions Docs: [debug](https://docs.github.com/en/actions/using-workflows/
55
55
# ::debug ::Hello World
56
56
```
57
57
58
- ### ** ` notice ` **
58
+ ### ** ` notice(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None) ` **
59
59
60
60
Prints colorful notice message to the action workflow console.
61
61
GitHub Actions Docs: [ notice] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message )
@@ -79,7 +79,7 @@ GitHub Actions Docs: [notice](https://docs.github.com/en/actions/using-workflows
79
79
# ::notice title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message=
80
80
```
81
81
82
- ### ** ` warning ` **
82
+ ### ** ` warning(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None) ` **
83
83
84
84
Prints colorful warning message to the action workflow console.
85
85
GitHub Actions Docs: [ warning] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message )
@@ -103,7 +103,7 @@ GitHub Actions Docs: [warning](https://docs.github.com/en/actions/using-workflow
103
103
# ::warning title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message
104
104
```
105
105
106
- ### ** ` error ` **
106
+ ### ** ` error(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None) ` **
107
107
108
108
Prints colorful error message to the action workflow console.
109
109
GitHub Actions Docs: [ error] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-error-message )
@@ -127,7 +127,7 @@ GitHub Actions Docs: [error](https://docs.github.com/en/actions/using-workflows/
127
127
# ::error title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message
128
128
```
129
129
130
- ### ** ` set_output ` **
130
+ ### ** ` set_output(name, value) ` **
131
131
132
132
Sets an action's output parameter for the running workflow.
133
133
GitHub Actions Docs: [ set_output] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter )
@@ -143,7 +143,7 @@ GitHub Actions Docs: [set_output](https://docs.github.com/en/actions/using-workf
143
143
# ::set-output name=test_name::test_value
144
144
```
145
145
146
- ### ** ` save_state ` **
146
+ ### ** ` save_state(name, value) ` **
147
147
148
148
Creates environment variable for sharing state with workflow's pre: or post: actions.
149
149
GitHub Actions Docs: [ save_state] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions )
@@ -159,7 +159,7 @@ GitHub Actions Docs: [save_state](https://docs.github.com/en/actions/using-workf
159
159
# ::save-state name=test_name::test_value
160
160
```
161
161
162
- ### ** ` get_state ` **
162
+ ### ** ` get_state(name) ` **
163
163
164
164
Gets state environment variable from running workflow.
165
165
@@ -174,7 +174,7 @@ Gets state environment variable from running workflow.
174
174
# test_value
175
175
```
176
176
177
- ### ** ` get_state ` **
177
+ ### ** ` get_user_input(name) ` **
178
178
179
179
Gets user input from running workflow.
180
180
@@ -189,7 +189,7 @@ Gets user input from running workflow.
189
189
# my value
190
190
```
191
191
192
- ### ** ` begin_stop_commands ` and ` end_stop_commands ` **
192
+ ### ** ` begin_stop_commands(token=None) ` and ` end_stop_commands(token) ` **
193
193
194
194
Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command.
195
195
GitHub Actions Docs: [ stop_commands] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#stopping-and-starting-workflow-commands )
@@ -221,7 +221,39 @@ GitHub Actions Docs: [stop_commands](https://docs.github.com/en/actions/using-wo
221
221
# ::my_token::
222
222
```
223
223
224
- ### ** ` add_mask ` **
224
+ ### ** ` start_group(title) ` and ` end_group() ` **
225
+
226
+ Creates an expandable group in the workflow log.
227
+ GitHub Actions Docs: [ group] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines )
228
+
229
+ ** example:**
230
+
231
+ ``` python
232
+ >> from github_action_utils import echo, start_group, end_group, group
233
+
234
+ >> start_group(" My Group Title" )
235
+ >> echo(" Hello World" )
236
+ >> end_group()
237
+
238
+ # Output:
239
+ # ::group ::My Group Title
240
+ # Hello World
241
+ # ::endgroup::
242
+
243
+ # ====================
244
+ # Using Group Context Manager
245
+ # ====================
246
+
247
+ >> with group(" My Group Title" ):
248
+ ... echo(" Hello World" )
249
+
250
+ # Output:
251
+ # ::group ::My Group Title
252
+ # Hello World
253
+ # ::endgroup::
254
+ ```
255
+
256
+ ### ** ` add_mask(value) ` **
225
257
226
258
Masking a value prevents a string or variable from being printed in the workflow console.
227
259
GitHub Actions Docs: [ add_mask] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#masking-a-value-in-log )
@@ -237,7 +269,7 @@ GitHub Actions Docs: [add_mask](https://docs.github.com/en/actions/using-workflo
237
269
# ::add-mask ::test value
238
270
```
239
271
240
- ### ** ` set_env ` **
272
+ ### ** ` set_env(name, value) ` **
241
273
242
274
Creates an environment variable by writing this to the ` GITHUB_ENV ` environment file which is available to any subsequent steps in a workflow job.
243
275
GitHub Actions Docs: [ set_env] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable )
@@ -250,7 +282,7 @@ GitHub Actions Docs: [set_env](https://docs.github.com/en/actions/using-workflow
250
282
>> set_env(" my_env" , " test value" )
251
283
```
252
284
253
- ### ** ` get_workflow_environment_variables ` **
285
+ ### ** ` get_workflow_environment_variables() ` **
254
286
255
287
Gets all environment variables from the ` GITHUB_ENV ` environment file which is available to the workflow.
256
288
GitHub Actions Docs: [ set_env] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable )
@@ -266,7 +298,7 @@ GitHub Actions Docs: [set_env](https://docs.github.com/en/actions/using-workflow
266
298
# {"my_env": "test value"}
267
299
```
268
300
269
- ### ** ` get_env ` **
301
+ ### ** ` get_env(name) ` **
270
302
271
303
Gets all environment variables from ` os.environ ` or the ` GITHUB_ENV ` environment file which is available to the workflow.
272
304
This can also be used to get [ environment variables set by GitHub Actions] ( https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables ) .
@@ -285,7 +317,7 @@ GitHub Actions Docs: [set_env](https://docs.github.com/en/actions/using-workflow
285
317
# https://api.github.com
286
318
```
287
319
288
- ### ** ` append_job_summary ` **
320
+ ### ** ` append_job_summary(markdown_text) ` **
289
321
290
322
Sets some custom Markdown for each job so that it will be displayed on the summary page of a workflow run.
291
323
GitHub Actions Docs: [ append_job_summary] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary )
@@ -299,7 +331,7 @@ GitHub Actions Docs: [append_job_summary](https://docs.github.com/en/actions/usi
299
331
```
300
332
301
333
302
- ### ** ` overwrite_job_summary ` **
334
+ ### ** ` overwrite_job_summary(markdown_text) ` **
303
335
304
336
Clears all content for the current step, and adds new job summary.
305
337
GitHub Actions Docs: [ overwrite_job_summary] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#overwriting-job-summaries )
@@ -312,7 +344,7 @@ GitHub Actions Docs: [overwrite_job_summary](https://docs.github.com/en/actions/
312
344
>> overwrite_job_summary(" # test summary" )
313
345
```
314
346
315
- ### ** ` remove_job_summary ` **
347
+ ### ** ` remove_job_summary() ` **
316
348
317
349
completely removes job summary for the current step.
318
350
GitHub Actions Docs: [ remove_job_summary] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#removing-job-summaries )
@@ -325,7 +357,7 @@ GitHub Actions Docs: [remove_job_summary](https://docs.github.com/en/actions/usi
325
357
>> remove_job_summary()
326
358
```
327
359
328
- ### ** ` add_system_path ` **
360
+ ### ** ` add_system_path(path) ` **
329
361
330
362
Prepends a directory to the system PATH variable (` GITHUB_PATH ` ) and automatically makes it available to all subsequent actions in the current job.
331
363
GitHub Actions Docs: [ add_system_path] ( https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path )
@@ -338,7 +370,7 @@ GitHub Actions Docs: [add_system_path](https://docs.github.com/en/actions/using-
338
370
>> add_system_path(" var/path/to/file" )
339
371
```
340
372
341
- ### ** ` event_payload ` **
373
+ ### ** ` event_payload() ` **
342
374
343
375
Get GitHub Event payload that triggered the workflow.
344
376
0 commit comments