Skip to content

Add --workflow-dir flag to compile command for custom workflow directories#740

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-cb77d34b-dea8-4fe2-84eb-8b5b7d98502a
Sep 11, 2025
Merged

Add --workflow-dir flag to compile command for custom workflow directories#740
pelikhan merged 3 commits intomainfrom
copilot/fix-cb77d34b-dea8-4fe2-84eb-8b5b7d98502a

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 11, 2025

This PR adds a --workflow-dir flag to the compile command that allows users to compile agentic workflows from a custom directory instead of the default .github/workflows directory.

Problem

Previously, the compile command was hard-coded to only work with workflows in .github/workflows. Users who wanted to organize their workflows in different directories (e.g., for different environments, teams, or purposes) had no way to compile them without moving files around.

Solution

Added a new --workflow-dir flag that:

  • Accepts a relative path to a directory containing workflow files
  • Defaults to .github/workflows when not specified (maintains backward compatibility)
  • Validates that the provided path is relative to the repository root (rejects absolute paths)
  • Works with all existing compile command features (watch mode, purge, validation, etc.)

Usage Examples

# Compile from default directory (unchanged behavior)
gh aw compile

# Compile from custom directory
gh aw compile --workflow-dir custom/workflows

# Compile specific files from custom directory using file paths
gh aw compile custom/workflows/my-workflow.md

# Error handling for invalid paths
gh aw compile --workflow-dir /absolute/path
# ✗ workflow-dir must be a relative path, got: /absolute/path

Implementation Details

  • Updated CompileWorkflows function signature to accept the new workflowDir parameter
  • Added path validation using filepath.IsAbs() and filepath.Clean()
  • Updated all existing function calls and tests to maintain compatibility
  • Added comprehensive test coverage for the new functionality
  • Updated help text and examples to demonstrate the new feature

Testing

  • All existing tests continue to pass (no regression)
  • Added new test file workflow_dir_test.go with comprehensive coverage:
    • Tests compilation from custom directories
    • Validates path validation logic
    • Tests default behavior when flag is empty
    • Tests error cases (absolute paths, missing directories)
  • Manual testing confirms proper operation with various directory structures

The implementation is minimal and surgical, adding the requested functionality without affecting existing workflows or breaking changes.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build3661079519/b278/cli.test -test.testlogfile=/tmp/go-build3661079519/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build137234823/b278/cli.test -test.testlogfile=/tmp/go-build137234823/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build2506742488/b278/cli.test -test.testlogfile=/tmp/go-build2506742488/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a "workflow-dir" flag to the "compile" command that allows to compile agentic workflows in a different folder than .github/workflows . Must be a relative folder to the current repository. Add --workflow-dir flag to compile command for custom workflow directories Sep 11, 2025
Copilot AI requested a review from pelikhan September 11, 2025 18:50
@pelikhan pelikhan marked this pull request as ready for review September 11, 2025 19:03
@pelikhan pelikhan merged commit 6f9a27d into main Sep 11, 2025
9 checks passed
@pelikhan pelikhan deleted the copilot/fix-cb77d34b-dea8-4fe2-84eb-8b5b7d98502a branch September 11, 2025 19:03
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.

2 participants