Video Thumbnail for Lesson
8.2: Developer Experience (Workflows)

Developer Experience (Workflows)

Externalize Workflow Logic

YAML should be orchestration glue, not the place where business logic lives.

One technique to apply this is to move logic from inline scripts out into the repo as standalone scripts or targets within a Makefile or Taskfile.

Moving logic into scripts or Taskfiles lets you test functionality locally, share it across workflows, and version it like any other source file.

jobs:
  # ❌ Avoid inline bash for anything except trivial commands
  say-hello-inline-bash:
    runs-on: ubuntu-24.04
    steps:
      - name: Echo Hello
        run: |
          echo "Hello from an inline bash script in a GitHub Action Workflow!"

  # âś… Instead, move the logic outside of the workflow!
  say-hello-external-task:
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout Code
        uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
      - name: Install Task
        uses: supplypike/setup-bin@8e3f88b4f143d9b5c3497f0fc12d45c83c123787 # v4.0.1
        with:
          uri: "https://github.com/go-task/task/releases/download/v3.44.1/task_linux_amd64.tar.gz"
          name: task
          version: v3.44.1
      - name: Echo Hello
        working-directory: ./08-developer-experience/workflows
        run: |
          task hello-world-task
# Taskfile.yaml
version: "3"

tasks:
  hello-world-task:
    cmds:
      - |
        echo "Hello from a Taskfile task called from a GitHub Action Workflow!"

Run Workflows Locally with act

Sometimes you need the full workflow context—matrix variables, environment configuration, and GitHub events—to reproduce a bug.

The act (https://github.com/nektos/act) CLI emulates the GitHub Actions runtime inside containers.

Once installed, a workflow can be executed with a command like:

act workflow_dispatch \
  --container-architecture linux/amd64 \
  -P ubuntu-24.04=node:16-bullseye-slim \
  --directory ../.. \
  -W '.github/workflows/08-developer-experience--01-externalize-logic.yaml'