GitHub Actions - Supercharged

· 2 min · medium

I've used several CI/CD platforms, including Bitbucket, GitLab and AWS CodePipeline, and GitHub Actions is the one I've come to appreciate most. In my opinion, its implementation is the best of them.

Its strengths:

Moving to GitHub Actions, for both personal and work projects, has mostly been seamless. There were occasional bumps, like artifacts ending up in the wrong place, but my overall impression is positive. So where are the pitfalls?

The challenge

Think of assembling flat-pack furniture. The instructions are clear and the pieces fit together intuitively, but checking every screw and bolt is in the right place is tedious. The only way to know is for someone to stress-test the finished piece. Not the most efficient method.

Consider this step:

steps:
  - name: Checkout repository
    uses: actions/checkout@v3
    with:
      ref: ${{ inputs.relase-tag }}

Did you spot it? The input is release-tag, but it's referenced as relase-tag. The result is a failed build.

Tools to the rescue

A few tools help you avoid the dreaded Process completed with exit code 1.

1. actionlint

actionlint is a static checker for GitHub Actions workflow files. It catches invalid definitions and common pitfalls:

Download the binary from its repository and run actionlint in your workflow directory. It's fast, which makes it a good fit for a git hook.

2. GitHub Actions for VS Code

The GitHub Actions extension for VS Code adds:

3. nektos/act

nektos/act runs GitHub Actions on your own machine. Feedback is fast, there's no need to push, and it saves on runner costs.

It uses Docker containers to emulate GitHub's runners, which keeps environments consistent, though those containers can lag behind GitHub as the platform changes. For experimenting with workflows, it's an excellent tool with a fast feedback loop. There's a good getting started guide.