When `gh aw add ./my-workflow.md` is run with a local workflow that has
`skills:` entries using local path references (e.g. `.github/skills/my-skill`
instead of the required `owner/repo/path@sha` form), the add command now
automatically rewrites those entries to fully-qualified remote specs before
writing the workflow to `.github/workflows/`.
The rewriting logic:
- Only runs for local workflow sources (sourceInfo.IsLocal)
- Detects local refs as any skill spec without an `@` separator
- Leaves GitHub Actions expressions (${{ ... }}) and already-qualified refs unchanged
- Normalises `./` prefixes and builds `owner/repo/path@sha` using the
current repository slug and HEAD commit SHA
- Handles both string form (`- .github/skills/my-skill`) and object form
(`- skill: .github/skills/my-skill`) YAML entries
Changes:
- pkg/cli/add_skill_rewrite.go: new file with detection, rewriting logic,
and helper functions
- pkg/cli/add_command.go: wire applyLocalSkillRefRewriting into
processWorkflowContentModifications
- pkg/cli/add_skill_rewrite_test.go: comprehensive unit tests
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
feat: rewrite local skill refs to qualified specs in add command
feat: rewrite local skill refs to qualified specs on gh aw add
pelikhan marked this pull request as ready for review
July 24, 2026 03:45Copilot AI review requested due to automatic review settings
July 24, 2026 03:45pelikhan deleted the copilot/update-add-command-local-to-remote branch
July 24, 2026 05:31Closed
mrjf
mentioned this pull request
Merged