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
- Extract shared steps into a composite or reusable workflow.
- Use defaults: and env: for shared settings instead of anchors.
.github/workflows/ci.yml
defaults:
run:
shell: bash
env:
NODE_ENV: testHow to prevent it
- Factor shared logic into composite or reusable workflows.
- Avoid anchors entirely in Actions YAML.
Related guides
GitHub Actions reusable workflow uses must be a valid pinned referenceFix the GitHub Actions error where a reusable workflow uses value is not a valid owner/repo/.github/workflows…
GitHub Actions "Invalid workflow file: error in your yaml syntax"Fix the GitHub Actions "Invalid workflow file: You have an error in your yaml syntax" message caused by tabs,…
GitHub Actions YAML "did not find expected key"Fix the GitHub Actions YAML error "did not find expected key" caused by broken indentation that leaves the pa…