Summary
When a shared workflow's run: step references a list-typed import-input via ${{ github.aw.import-inputs.X }}, gh-aw substitutes the value at compile time using Go's default slice formatter (fmt.Sprint), which produces [a b] (space-separated, no quotes) instead of valid JSON. This is fine for echo but breaks any consumer that expects JSON, including the very common pattern of feeding the value to jq --argjson.
There is currently no documented escape hatch (e.g. ${{ toJSON(github.aw.import-inputs.X) }} is not resolved at compile time -- it's preserved as a runtime expression that GH Actions can't evaluate, since github.aw.* doesn't exist at runtime).
Repro
shared/foo.md:
---
import-schema:
packages:
type: array
items:
type: string
on: workflow_call
jobs:
show:
runs-on: ubuntu-latest
steps:
- env:
PKGS: ${{ github.aw.import-inputs.packages }}
run: |
printf 'env value: %s\n' "$PKGS"
echo "$PKGS" | jq --argjson p "$PKGS" '.'
---
caller.md:
---
on: push
imports:
- uses: shared/foo.md
with:
packages:
- microsoft/apm#main
- github/awesome-copilot/skills/foo
---
After gh aw compile caller:
env:
PKGS: "[microsoft/apm#main github/awesome-copilot/skills/foo]"
env value: [microsoft/apm#main github/awesome-copilot/skills/foo]
jq: invalid JSON text passed to --argjson
##[error]Process completed with exit code 2.
Reproduced with gh aw v0.71.1. Behaviour identical on v0.68.3.
Expected
Either:
- Substitute import-input arrays as JSON (
["a","b"]). This matches the schema (type: array) and Just Works for both echo and jq.
- Expose a compile-time JSON helper, e.g.
${{ jsonInputs.packages }} or make ${{ toJSON(github.aw.import-inputs.packages) }} resolvable at compile time.
Why this matters
We hit this in microsoft/apm's shared workflow that fans out APM packages into a credential-group matrix using jq --argjson packages .... Every PR-review-panel and triage-panel run failed in apm-prep until we added a Bash+Python repair shim that detects the Go-slice format and rewrites it as JSON before jq sees it (microsoft/apm#1031 follow-up). This shim is purely a workaround -- a one-line compiler change would let every shared-workflow author treat import-input arrays as JSON natively.
Happy to send a PR if you can point me at the substitution code path.
Summary
When a shared workflow's
run:step references a list-typed import-input via${{ github.aw.import-inputs.X }}, gh-aw substitutes the value at compile time using Go's default slice formatter (fmt.Sprint), which produces[a b](space-separated, no quotes) instead of valid JSON. This is fine forechobut breaks any consumer that expects JSON, including the very common pattern of feeding the value tojq --argjson.There is currently no documented escape hatch (e.g.
${{ toJSON(github.aw.import-inputs.X) }}is not resolved at compile time -- it's preserved as a runtime expression that GH Actions can't evaluate, sincegithub.aw.*doesn't exist at runtime).Repro
shared/foo.md:caller.md:After
gh aw compile caller:Reproduced with
gh aw v0.71.1. Behaviour identical onv0.68.3.Expected
Either:
["a","b"]). This matches the schema (type: array) and Just Works for bothechoandjq.${{ jsonInputs.packages }}or make${{ toJSON(github.aw.import-inputs.packages) }}resolvable at compile time.Why this matters
We hit this in microsoft/apm's shared workflow that fans out APM packages into a credential-group matrix using
jq --argjson packages .... Every PR-review-panel and triage-panel run failed inapm-prepuntil we added a Bash+Python repair shim that detects the Go-slice format and rewrites it as JSON before jq sees it (microsoft/apm#1031 follow-up). This shim is purely a workaround -- a one-line compiler change would let every shared-workflow author treat import-input arrays as JSON natively.Happy to send a PR if you can point me at the substitution code path.