In this talk for Laracon EU 2022, I walk through what GitHub Actions are and how you can create your own Actions using Minicli, a microframework for the command line in PHP.
GitHub Actions Overview ● Feature that allows GitHub users to create automated pipelines that can be triggered by events or run on schedule ● Popular for CI/CD ● Open source repos get unlimited action runs for free ● The GitHub Marketplace has a large collection of ready-to-use Actions contributed by the community
Actions ● Self-contained units of execution that can be combined in workflows ● Actions live in dedicated repositories with an action.yml file that defines its configuration ● You can combine actions from the marketplace with your own custom actions ● Actions must be packaged as Docker images
Workflows ● A configurable process that runs one or more jobs ● Each job can have multiple steps ● Steps can be either an Action or a shell script ● Steps run in order and share data ● Jobs run in parallel unless otherwise specified ● Defined in a YAML file committed to the repository ● You can have several different workflows in the same repository
Triggers ● Workflows can be triggered by events such as new commits, new issues, when a PR is created, etc ● Workflows can also run on schedule, similar to cron jobs ● When on schedule, the minimal interval is five minutes
Action Secrets ● Encrypted environment variables accessible only by GitHub Actions ● Can be set at repository level or per environment ● Ideal for storing API keys and auth tokens
Preparation ● What will trigger this action? ● Do I need to combine this action with others? ● Do I need to use repository secrets or environment variables to configure my action? ● If my action creates output that needs to be persisted, where this content goes?
References / Useful Links ● ImportDevTo Action Repository ○ https://github.com/erikaheidi/importDevTo ● How to Create a GitHub Action to Import Posts from DEV to a Repository you Own (tutorial) ○ https://bit.ly/38nANwc ● GitHub Actions documentation ○ https://docs.github.com/en/actions ● Minicli documentation ○ https://docs.minicli.dev ● Other actions built with Minicli ○ Dynacover: https://github.com/erikaheidi/dynacover-actions ○ Update CONTRIBUTORS: https://github.com/minicli/action-contributors