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()
@workflow.action()
def greetings_action(name: str, age: int) -> None:
workflow.write(
{
"phrase": f"Hello {name}. You are {age}!"
}
)
# $ pyaction run
# ┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ Variable ┃ Value ┃ Type ┃ Workflow Usage ┃
# ┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
# │ phrase │ Hello Jane. You are 20! │ <class 'str'> │ ${{ 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 pure pyaction
release is made to be super light which will cause your workflow to run fast.
flowchart TB
subgraph GitHub Runner
pyaction-->pydantic;
end
pc[pyaction-cli]-->pyaction;
pc[pyaction-cli]-->rich;
pc[pyaction-cli]-->copier;
pc[pyaction-cli]-->_[click];
The pyaction-cli
that you install under the name of pyaction[cli]
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.