@@ -20,11 +20,11 @@ Install `github-action-utils` using pip:
2020pip install github-action-utils
2121```
2222
23- ## Usage
23+ ## Available Functions
2424
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 .
2626
27- ### ** ` echo ` **
27+ ### ** ` echo(message) ` **
2828
2929Prints specified message to the action workflow console.
3030
@@ -39,7 +39,7 @@ Prints specified message to the action workflow console.
3939# Hello World
4040```
4141
42- ### ** ` debug ` **
42+ ### ** ` debug(message) ` **
4343
4444Prints colorful debug message to the action workflow console.
4545GitHub 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/
5555# ::debug ::Hello World
5656```
5757
58- ### ** ` notice ` **
58+ ### ** ` notice(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None) ` **
5959
6060Prints colorful notice message to the action workflow console.
6161GitHub 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
7979# ::notice title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message=
8080```
8181
82- ### ** ` warning ` **
82+ ### ** ` warning(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None) ` **
8383
8484Prints colorful warning message to the action workflow console.
8585GitHub 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
103103# ::warning title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message
104104```
105105
106- ### ** ` error ` **
106+ ### ** ` error(message, title=None, file=None, col=None, end_column=None, line=None, end_line=None) ` **
107107
108108Prints colorful error message to the action workflow console.
109109GitHub 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/
127127# ::error title=test title,file=abc.py,col=1,endColumn=2,line=4,endLine=5::test message
128128```
129129
130- ### ** ` set_output ` **
130+ ### ** ` set_output(name, value) ` **
131131
132132Sets an action's output parameter for the running workflow.
133133GitHub 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
143143# ::set-output name=test_name::test_value
144144```
145145
146- ### ** ` save_state ` **
146+ ### ** ` save_state(name, value) ` **
147147
148148Creates environment variable for sharing state with workflow's pre: or post: actions.
149149GitHub 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
159159# ::save-state name=test_name::test_value
160160```
161161
162- ### ** ` get_state ` **
162+ ### ** ` get_state(name) ` **
163163
164164Gets state environment variable from running workflow.
165165
@@ -174,7 +174,7 @@ Gets state environment variable from running workflow.
174174# test_value
175175```
176176
177- ### ** ` get_state ` **
177+ ### ** ` get_user_input(name) ` **
178178
179179Gets user input from running workflow.
180180
@@ -189,7 +189,7 @@ Gets user input from running workflow.
189189# my value
190190```
191191
192- ### ** ` begin_stop_commands ` and ` end_stop_commands ` **
192+ ### ** ` begin_stop_commands(token=None) ` and ` end_stop_commands(token) ` **
193193
194194Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command.
195195GitHub 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
221221# ::my_token::
222222```
223223
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) ` **
225257
226258Masking a value prevents a string or variable from being printed in the workflow console.
227259GitHub 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
237269# ::add-mask ::test value
238270```
239271
240- ### ** ` set_env ` **
272+ ### ** ` set_env(name, value) ` **
241273
242274Creates an environment variable by writing this to the ` GITHUB_ENV ` environment file which is available to any subsequent steps in a workflow job.
243275GitHub 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
250282>> set_env(" my_env" , " test value" )
251283```
252284
253- ### ** ` get_workflow_environment_variables ` **
285+ ### ** ` get_workflow_environment_variables() ` **
254286
255287Gets all environment variables from the ` GITHUB_ENV ` environment file which is available to the workflow.
256288GitHub 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
266298# {"my_env": "test value"}
267299```
268300
269- ### ** ` get_env ` **
301+ ### ** ` get_env(name) ` **
270302
271303Gets all environment variables from ` os.environ ` or the ` GITHUB_ENV ` environment file which is available to the workflow.
272304This 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
285317# https://api.github.com
286318```
287319
288- ### ** ` append_job_summary ` **
320+ ### ** ` append_job_summary(markdown_text) ` **
289321
290322Sets some custom Markdown for each job so that it will be displayed on the summary page of a workflow run.
291323GitHub 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
299331```
300332
301333
302- ### ** ` overwrite_job_summary ` **
334+ ### ** ` overwrite_job_summary(markdown_text) ` **
303335
304336Clears all content for the current step, and adds new job summary.
305337GitHub 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/
312344>> overwrite_job_summary(" # test summary" )
313345```
314346
315- ### ** ` remove_job_summary ` **
347+ ### ** ` remove_job_summary() ` **
316348
317349completely removes job summary for the current step.
318350GitHub 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
325357>> remove_job_summary()
326358```
327359
328- ### ** ` add_system_path ` **
360+ ### ** ` add_system_path(path) ` **
329361
330362Prepends a directory to the system PATH variable (` GITHUB_PATH ` ) and automatically makes it available to all subsequent actions in the current job.
331363GitHub 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-
338370>> add_system_path(" var/path/to/file" )
339371```
340372
341- ### ** ` event_payload ` **
373+ ### ** ` event_payload() ` **
342374
343375Get GitHub Event payload that triggered the workflow.
344376
0 commit comments