> ## Documentation Index
> Fetch the complete documentation index at: https://athanor.alexisbouchez.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing Workflows

> Author workflows that Athanor can execute

Athanor runs standard GitHub Actions workflow YAML. If your workflow works on GitHub, it should work on Athanor (within the [supported features](/reference/supported-features)).

## Minimal Workflow

```yaml theme={null}
name: CI
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run: go build ./...
      - name: Test
        run: go test ./...
```

## Using Expressions

Athanor evaluates `${{ }}` expressions with full context support:

```yaml theme={null}
steps:
  - name: Show info
    run: |
      echo "Repo: ${{ github.repository }}"
      echo "SHA: ${{ github.sha }}"
      echo "Branch: ${{ github.ref_name }}"
```

## Matrix Strategy

```yaml theme={null}
jobs:
  test:
    strategy:
      matrix:
        go: ['1.21', '1.22']
        os: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Test with Go ${{ matrix.go }}
        run: go test ./...
```

## Job Dependencies and Outputs

```yaml theme={null}
jobs:
  build:
    outputs:
      version: ${{ steps.ver.outputs.version }}
    steps:
      - id: ver
        run: echo "version=1.0.0" >> "$GITHUB_OUTPUT"

  deploy:
    needs: build
    steps:
      - run: echo "Deploying ${{ needs.build.outputs.version }}"
```

## Conditions

```yaml theme={null}
steps:
  - name: Always runs
    if: always()
    run: echo "cleanup"

  - name: Only on failure
    if: failure()
    run: echo "something went wrong"

  - name: Branch check
    if: github.ref_name == 'main'
    run: echo "on main"
```

## Environment Variables

Three levels, where each inherits from the one above:

```yaml theme={null}
env:
  GLOBAL_VAR: hello

jobs:
  build:
    env:
      JOB_VAR: world
    steps:
      - name: Use vars
        env:
          STEP_VAR: "!"
        run: echo "$GLOBAL_VAR $JOB_VAR$STEP_VAR"

      - name: Set env for next steps
        run: echo "DYNAMIC=value" >> "$GITHUB_ENV"
```

## Job Defaults

Set default shell and working directory for all steps in a job:

```yaml theme={null}
jobs:
  build:
    defaults:
      run:
        shell: bash
        working-directory: ./src
    steps:
      - run: pwd          # runs in ./src
      - run: echo "hi"
        shell: sh         # overrides the default
```

## Notes for Athanor

* `runs-on:` is parsed but not used for image selection. All jobs run in the same rootfs.
* `actions/checkout@v4` has a built-in shim. It runs a `git checkout` on the already-cloned workspace.
* Node.js actions work if `node` is installed in the VM rootfs
* Docker actions (`docker://`) are not supported
