PyAction helps you to develop GitHub Actions using Python. It's delivered as an installable package with the ability to test the action locally before any deployment.
- name: Using the python action
uses: you/your-python-action@v2
with:
name: Jane
age: 20
from pyaction import PyAction
workflow = PyAction()
@workflow.action()
def greetings_action(name: str, age: int) -> None:
workflow.write(
{
"phrase": f"Hello {name}. You are {age}!"
}
)
# $ pyaction run
# [
# {
# "var": "phrase",
# "value": "Hello Jane. You are 20!",
# "type": "<class 'str'>",
# "usage": "${{ steps.STEP_ID.outputs.phrase }}"
# }
# ]
Check out the official docs for more detailed information. There is also a Quickstart demo tutorial that walks you through a simple hello-world action.
Run the following command in a fresh CLI tab.
pip install -U "pyaction[cli]"
To make sure the installation process was successful, run the following command.
pyaction --version
The pyaction
release is made to be super light which will make your workflow run very fast. The pyaction[cli]
that you install on your local machine has some additional packages for local development.
It's recommended to initialize a template, then going along the development process. Thus, run the init
command.
pyaction init
Answer the prompts and your template will be generated. Check out the docs for the further steps.
All your contributions and assistance are welcome. For more information about how you can contribute to the project, please follow the instructions here. ✨
PyAction is licensed under the MIT License terms.