← Back

New features of GitHub Actions v2

You might have read about a big update to GitHub Actions - TLDR, a lot is different but the overall concept is the same. It’s a thing-doer; it lets you run arbitrary “jobs” in GitHub-orchestrated VMs.

In August, a ton of new functionality and changes were introduced to the platform. These centered around using Actions for CI, but in continuation with my previous blog posts, I want to highlight some features for doing more than just running your tests. Let’s goooo ➡️

Primer on the changes

You should definitely check out the new documentation to get a full look at using Actions, but I’ll note some key differences with Actions v1.

  • Workflows were written in HCL; now they’re written in YAML. Syntax documentation is available! Also check out these starter workflows.
  • Instead of multiple actions in a workflow, we now have a more granular breakdown of workflow > jobs > steps.
  • Jobs are run in VMs instead of containers - including MacOS, Windows and Linux 😍🥰
  • There’s now an official actions/toolkit, that includes some special interactions with the runtime.
  • The visual workflow editor is no longer available; I don’t know if there are plans to bring it back for the new YAML workflows or not.

In the rest of this post I’m going to focus on a few features that I think are an amazing addition to the Actions platform. Some are pure additions (didn’t exist in v1), others are adaptations/improvements on features that did exist.

Multi-line scripts

In v1, you could kind of run arbitrary shell scripts without having to create an actual file:

action "My action" {
  uses = "docker://alpine"
  run = "echo"
  args = ["Hello", "World"]
}

This would spin up a Docker container from the alpine image, and run echo "Hello world". This came in handy in a lot of situations, but had a few limitations; for simple scripts, it meant creating a whole Docker image, and running multiple commands could feel really verbose. In Actions v2, you can just define a run property, and give it a multiline string, with multiple commands in one step 🤯

steps:
  - name: Run this script