This package is a collection of python functions that can be used to run GitHub Action Workflow Commands from a python script inside a workflow.
name: run-python-script
on:
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install github-action-utils
- name: Run Python Script
shell: python
run: |
import github_action_utils as gha_utils
with gha_utils.group("My Group"):
gha_utils.error(
"Error message", title="Error Title", file="example.py",
col=1, end_column=2, line=1, end_line=2,
)
gha_utils.notice("Another notice message")
gha_utils.append_job_summary("# Hello World")
import github_action_utils as gha_utils
with gha_utils.group("My Group"):
gha_utils.set_output("test_var", "test_value")
gha_utils.save_state("state", "val")
gha_utils.debug("Debug message")
gha_utils.warning(
"Warning message", title="Warning Title", file="example.py",
col=1, end_column=2, line=5, end_line=6,
)
gha_utils.warning("Another warning message")
gha_utils.error(
"Error message", title="Error Title", file="example.py",
col=1, end_column=2, line=1, end_line=2,
)
gha_utils.notice("Another notice message")
gha_utils.append_job_summary("# Hello World")
gha_utils.append_job_summary("- Point 1")
gha_utils.append_job_summary("- Point 2")
The code in this project is released under the MIT License.