Skip to content

Commit 1887d58

Browse files
authored
Update README.md
1 parent d67e089 commit 1887d58

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,48 @@
22

33
A collection of python functions that can be used to run [GitHub Action Workflow Commands](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions) from a python script.
44

5-
### Example:
5+
## Example:
6+
7+
### Example Workflow:
8+
9+
```yaml
10+
name: run-python-script
11+
12+
on:
13+
pull_request:
14+
branches: [ "main" ]
15+
16+
jobs:
17+
build:
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Set up Python 3.10
25+
uses: actions/setup-python@v3
26+
with:
27+
python-version: "3.10"
28+
29+
- name: Install dependencies
30+
run: python -m pip install github-action-utils
31+
32+
- name: Run Python Script
33+
shell: python
34+
run: |
35+
import github_action_utils as gha_utils
36+
37+
with gha_utils.group("My Group"):
38+
gha_utils.error(
39+
"Error message", title="Error Title", file="example.py",
40+
col=1, end_column=2, line=1, end_line=2,
41+
)
42+
gha_utils.notice("Another notice message")
43+
gha_utils.append_job_summary("# Hello World")
44+
```
45+
46+
### Example Code:
647
748
```python
849
import github_action_utils as gha_utils

0 commit comments

Comments
 (0)