Skip to content
Latchkey

GitHub Actions "Anchors are not currently supported" (YAML anchors)

GitHub Actions does not support YAML anchors (&) and aliases (*). Using them to deduplicate config makes the workflow invalid.

What this error means

The workflow is rejected with "Anchors are not currently supported" at the line using & or *.

github-actions
Invalid workflow file: .github/workflows/ci.yml#L10
Anchors are not currently supported. Remove the anchor 'defaults'

Common causes

Anchor and alias to share config

Defining &defaults and reusing it with *defaults is standard YAML but unsupported here.

Merge keys (<<)

YAML merge keys rely on anchors and are likewise unsupported.

How to fix it

Replace anchors with composites or duplication

  1. Extract shared steps into a composite or reusable workflow.
  2. Use defaults: and env: for shared settings instead of anchors.
.github/workflows/ci.yml
defaults:
  run:
    shell: bash
env:
  NODE_ENV: test

How to prevent it

  • Factor shared logic into composite or reusable workflows.
  • Avoid anchors entirely in Actions YAML.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →