Skip to content

Clarify and regress gh aw add spec handling for direct paths and shorthand @ref forms#35175

Closed
Copilot wants to merge 6 commits into
mainfrom
copilot/fix-gh-aw-add-workflow-path
Closed

Clarify and regress gh aw add spec handling for direct paths and shorthand @ref forms#35175
Copilot wants to merge 6 commits into
mainfrom
copilot/fix-gh-aw-add-workflow-path

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 27, 2026

gh aw add was ambiguous for direct workflow file specs with branch refs (especially slash-delimited branch names), and users could reasonably interpret failures as package-parser rejection. This change makes supported direct-path usage explicit and adds regression coverage to lock behavior.

  • Problem framing

    • gh aw add owner/repo/path/to/workflow.md@ref should be treated as a direct workflow spec, not as a repository package (aw.yml) lookup.
    • Branch refs like feature/github-agentic-workflows should remain valid in @ref.
    • Existing shorthand specs should remain supported:
      • owner/repo@ref (repository package at root manifest)
      • owner/repo/route@ref (fallback to direct workflow shorthand when nested package manifest is missing)
  • Behavioral regression coverage

    • Added a focused ResolveWorkflows test for:
      • owner/repo/agentic-workflows/pr-review.md@feature/github-agentic-workflows
      • Asserts it resolves as workflow path + version ref
      • Asserts package-manifest resolution is not invoked for this input
    • Added regression coverage for:
      • owner/repo@feature/github-agentic-workflows
        • Asserts repository-package resolution uses and propagates explicit ref
      • owner/repo/review@feature/github-agentic-workflows
        • Asserts missing nested manifest falls back to direct workflow shorthand with ref preserved
    • Extended package-spec parser tests to confirm:
      • .md@ref input is not classified as a repository package
      • owner/repo@ref is classified as a repository package with the parsed ref
  • CLI/docs clarity

    • Updated gh aw add help examples to include direct file-path + slash-delimited branch ref usage.
    • Updated setup docs with the same explicit example to remove ambiguity between package specs and direct workflow specs.
gh aw add my-org/my-repo/agentic-workflows/pr-review.md@feature/github-agentic-workflows

Copilot AI and others added 2 commits May 27, 2026 10:29
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix gh aw add to accept direct workflow file path with branch ref Clarify and regress direct owner/repo/path.md@ref handling in gh aw add May 27, 2026
Copilot AI requested a review from pelikhan May 27, 2026 10:39
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot

These specs should be supported/

owner/repo/route@ref
owner/repo@ref

Copilot AI and others added 2 commits May 27, 2026 10:59
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 27, 2026

@copilot

These specs should be supported/...

Addressed in 1858946 (plus follow-up 0b8459e): added regression coverage for both owner/repo/route@ref fallback workflow resolution and owner/repo@ref repository-package resolution/ref propagation.

Copilot AI changed the title Clarify and regress direct owner/repo/path.md@ref handling in gh aw add Clarify and regress gh aw add spec handling for direct paths and shorthand @ref forms May 27, 2026
@pelikhan pelikhan marked this pull request as ready for review May 27, 2026 11:06
Copilot AI review requested due to automatic review settings May 27, 2026 11:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR clarifies how gh aw add interprets shorthand specs vs direct workflow-path specs when an @ref is present (including slash-delimited branch names), and adds regression tests/docs to lock the intended behavior.

Changes:

  • Added regression tests for ResolveWorkflows and repository-package parsing to ensure direct .md@ref specs are not treated as repository packages, and that refs propagate correctly for repo packages and fallback shorthand.
  • Updated gh aw add help text and setup docs to include an explicit direct file-path example using a slash-delimited branch ref.
  • Updated an auto-generated workflow lock file, including a schedule change and a firewall allowlist change.
Show a summary per file
File Description
pkg/cli/add_package_manifest_test.go Adds regression tests covering @ref handling across repo packages, fallback behavior, and direct workflow paths.
pkg/cli/add_command.go Updates CLI help examples/wording to clarify that branch names with slashes are supported in @version.
docs/src/content/docs/setup/cli.md Adds a setup-doc example for direct workflow path + slash-delimited branch ref.
.github/workflows/daily-compiler-threat-spec-optimizer.lock.yml Regenerates a compiled/locked workflow with a changed cron schedule and updated network allowlist.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 2

Comment on lines 62 to +66
name: "Daily Compiler Threat Spec Optimizer"
on:
schedule:
- cron: "19 2 * * *"
# Friendly format: daily (scattered)
- cron: "6 3 * * 1"
# Friendly format: weekly on monday around 03:00 (scattered)
Comment on lines 1347 to 1350
export COPILOT_API_KEY="$COPILOT_DUMMY_BYOK"
(umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.55/awf-config.schema.json","network":{"allowDomains":["api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","github.com","host.docker.internal","telemetry.enterprise.githubcopilot.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000},"container":{"imageTag":"0.25.55"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json"
printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.55/awf-config.schema.json","network":{"allowDomains":["api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","github.com","host.docker.internal","registry.npmjs.org","telemetry.enterprise.githubcopilot.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000},"container":{"imageTag":"0.25.55"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json"
cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
@pelikhan pelikhan closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh aw add rejects a direct workflow file path with a branch ref

3 participants