Loading...
Loading...
Author and review GitHub Actions workflow YAML safely so syntactically-valid YAML can't ship a workflow that GitHub Actions refuses to run. USE FOR: editing, adding, or reviewing any file under .github/workflows/, writing run-name/name/if/env/run values that contain ${{ }} expressions, diagnosing a run that fails with 'This run likely failed because of a workflow file issue' and no jobs starting, deciding when a workflow scalar must be quoted, validating workflows with actionlint. DO NOT USE FOR: authoring application YAML unrelated to GitHub Actions, Azure Pipelines, GitLab CI, or non-workflow YAML. SCOPE: this skill covers *syntactic/structural* correctness of workflow YAML (quoting, parsing, actionlint); for *semantic and functional* workflow design (what a workflow should do, agentic-workflow behavior), see .github/agents/agentic-workflows.agent.md — the two are complementary. INVOKES: actionlint (downloaded pinned binary) plus git/grep for inspection.
npx skill4agent add dotnet/skills authoring-github-workflowsyaml.safe_load#actionlintScope: syntactic vs. semantic. This skill is about the syntactic and structural correctness of workflow YAML — quoting, parsing, and-level validity that determines whether GitHub Actions will load and run a file at all. It is not about what a workflow should do or how an agentic workflow should behave. For semantic and functional guidance (designing workflow logic, agentic-workflow patterns, gh-aw authoring), useactionlint. The two are complementary: get the behavior right with the agent, get the YAML right with this skill..github/agents/agentic-workflows.agent.md
.github/workflows/run-namenameifenvwithrun${{ }}mainrun:#### BAD — the run-name is silently truncated at " #"
run-name: ${{ inputs.pr_number != '' && format('Evaluate PR #{0} @ {1}', inputs.pr_number, inputs.head_sha) || '' }}run-name: ${{ inputs.pr_number != '' && format('Evaluate PR${{yaml.safe_load# GOOD — wrap the whole value in double quotes so '#' stays inside the scalar
run-name: "${{ inputs.pr_number != '' && format('Evaluate PR #{0} @ {1}', inputs.pr_number, inputs.head_sha) || '' }}"dotnet/skillsmain| Character / pattern | Why it breaks | Fix |
|---|---|---|
space then | Starts a YAML comment; truncates the value | Quote the whole value |
Leading | YAML anchors/aliases/tags/block scalars | Quote the value |
Leading | Parsed as flow mapping/sequence (a bare | Quote the value |
| Parsed as a nested mapping key | Quote the value |
| Leading/trailing spaces that matter | Plain scalars strip them | Quote the value |
Values that are | YAML type coercion | Quote the value |
namerun-nameifenvwith${{ }}#:git diff --name-only origin/main... -- .github/workflows/${{##${{ }}actionlintACTIONLINT_VERSION=1.7.7
ACTIONLINT_SHA256=023070a287cd8cccd71515fedc843f1985bf96c436b7effaecce67290e7e0757
curl -fsSLo actionlint.tar.gz \
"https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
# Verify the download against the pinned checksum before extracting/executing it:
echo "${ACTIONLINT_SHA256} actionlint.tar.gz" | sha256sum -c -
tar -xzf actionlint.tar.gz actionlint
# Focus on workflow/expression correctness; silence shell/py style noise:
./actionlint -shellcheck= -pyflakes= -color .github/workflows/*.ymlactionlint_<ver>_windows_amd64.zipExpand-Archivegot unexpected EOF while lexing end of string literal, expecting ''' [expression]0yaml.safe_loadyamllintactionlintactionlint.github/workflows/actionlint.yml.github/workflows/${{ }}#actionlint -shellcheck= -pyflakes= .github/workflows/*.yml0actionlint| Pitfall | Solution |
|---|---|
Unquoted | Wrap the whole value in double quotes |
Trusting | Run |
Escaping | Don't — quote the scalar instead; escaping breaks the expression |
| Using single quotes around a value that contains single quotes | Use double quotes for the outer scalar |
Adding | Run with |
| Assuming a green YAML lint means the workflow will run | Push and confirm jobs actually start, or rely on the actionlint gate |
.agents/skills/create-skill/SKILL.md