Skip to content

lnxpy/pyaction

Repository files navigation

PyAction - Create GitHub Actions Using Python! ✨ download rate

Version) Python Versions Package Testing Docs CI

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.

Installation

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.

Usage

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.

Contribution

All your contributions and assistance are welcome. For more information about how you can contribute to the project, please follow the instructions here. ✨

License

PyAction is licensed under the MIT License terms.