Skip to content

Allow workflow specs to be full GitHub links#1262

Merged
pelikhan merged 3 commits intomainfrom
copilot/add-full-github-links-support
Oct 6, 2025
Merged

Allow workflow specs to be full GitHub links#1262
pelikhan merged 3 commits intomainfrom
copilot/add-full-github-links-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 6, 2025

Resolves the issue by adding support for full GitHub URLs as workflow specifications in the gh aw add command.

Problem

Previously, users could only add workflows using the short-form specification format:

gh aw add githubnext/gh-aw-trial/workflows/release-issue-linker.md

This required manually constructing the spec string with the correct format. When browsing workflows on GitHub's web interface, users couldn't simply copy the URL and use it directly.

Solution

Users can now use full GitHub URLs directly:

gh aw add https://github.com/githubnext/gh-aw-trial/blob/main/workflows/release-issue-linker.md

The implementation automatically:

  • Extracts owner/repo from the URL
  • Identifies the file path within the repository
  • Detects the branch, tag, or commit SHA from the URL structure
  • Validates the URL format and domain

Supported URL Formats

All standard GitHub URL formats are supported:

  1. Blob URLs (most common - from GitHub web UI):

    https://github.com/owner/repo/blob/branch/path/to/workflow.md
    
  2. Tree URLs (from directory views):

    https://github.com/owner/repo/tree/branch/path/to/workflow.md
    
  3. Raw URLs (direct file content):

    https://github.com/owner/repo/raw/branch/path/to/workflow.md
    

All URL formats work with branches, version tags, and commit SHAs.

Implementation Details

  • Added parseGitHubURL() function to parse and validate GitHub URLs
  • Updated parseWorkflowSpec() to detect HTTP/HTTPS URLs and route them appropriately
  • Maintains full backward compatibility with existing spec formats
  • Includes comprehensive validation with clear error messages

Testing

  • Added 16 new test cases covering all URL formats and error conditions
  • All existing tests continue to pass
  • Documentation and help text updated with examples

Benefits

  • Convenience: Copy URLs directly from GitHub's web interface
  • Clarity: Branch/tag information is visible in the URL
  • Flexibility: Works alongside all existing spec formats
  • Safety: Validates domain, path structure, and file extensions
Original prompt

This section details on the original issue you should resolve

<issue_title>Allow workflow specs to be full github links</issue_title>
<issue_description>We should allow workflow specs to be full github links too, e.g.

gh aw add githubnext/gh-aw-trial/workflows/release-issue-linker.md 

could be

gh aw add https://github.com/githubnext/gh-aw-trial/blob/main/workflows/release-issue-linker.md

That gives a branch story as well</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1259

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 6, 2025 18:19
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] Allow full GitHub links for workflow specs Allow workflow specs to be full GitHub links Oct 6, 2025
Copilot AI requested a review from pelikhan October 6, 2025 18:25
@pelikhan pelikhan marked this pull request as ready for review October 6, 2025 18:33
@pelikhan pelikhan enabled auto-merge (squash) October 6, 2025 18:38
@pelikhan pelikhan disabled auto-merge October 6, 2025 18:39
@pelikhan pelikhan merged commit 9b921bf into main Oct 6, 2025
@pelikhan pelikhan deleted the copilot/add-full-github-links-support branch October 6, 2025 18:39
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.

Allow workflow specs to be full github links

2 participants