Skip to content

Add CLI build steps for dev mode in agentic-workflows action#13996

Merged
pelikhan merged 15 commits intomainfrom
copilot/update-agentic-workflows-cli-steps
Feb 6, 2026
Merged

Add CLI build steps for dev mode in agentic-workflows action#13996
pelikhan merged 15 commits intomainfrom
copilot/update-agentic-workflows-cli-steps

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Completed: Update agentic-workflows action dev mode to build CLI locally

Summary

Successfully implemented CLI build steps for dev mode and fully optimized the MCP configuration to use the built Docker image's defaults for minimal configuration overhead.

Implementation Steps

  • Add build steps injection for dev mode in agent job
    • Setup Go for CLI build
    • Build CLI binary using CI build command (not release build)
    • Setup Docker Buildx
    • Build Docker image and tag as localhost/gh-aw:dev
    • Build steps only added when needsCheckout is true
    • Build steps only generated when agentic-workflows tool is enabled
  • Update MCP server config to use locally built image in dev mode
    • Add constant DevModeGhAwImage = "localhost/gh-aw:dev"
    • Modify renderAgenticWorkflowsMCPConfigWithOptions (JSON format)
    • Modify renderAgenticWorkflowsMCPConfigTOML (TOML format)
    • Modify renderAgenticWorkflowsTOML (renderer method)
    • Skip predownload for locally built image in dev mode
  • Optimize dev mode configuration for built image
    • Remove entrypoint field (uses container's default ENTRYPOINT from Dockerfile)
    • Remove entrypointArgs field (uses container's default CMD from Dockerfile)
    • Remove /opt/gh-aw:/opt/gh-aw:ro mount (binary is in the image)
    • Remove /usr/bin/gh:/usr/bin/gh:ro mount (gh CLI is in the image)
    • Add DEBUG environment variable (set to "*" for full logging)
    • Add GH_TOKEN environment variable
    • Add GITHUB_TOKEN environment variable
    • Keep workspace and temp directory mounts only
  • Update Dockerfile default CMD
    • Changed from CMD ["--help"] to CMD ["mcp-server", "--cmd", "gh-aw"]
  • Use CI build command (not release build)
    • Changed from -ldflags "-X 'github.com/github/gh-aw/pkg/workflow.isReleaseBuild=false'"
    • To -ldflags "-s -w -X main.version=${VERSION}" (matches CI/Makefile)
  • All tests pass and 145 workflows recompiled successfully

Conditional Build Steps

Build steps are now only generated when:

  • Action mode is dev AND
  • The agentic-workflows tool is enabled in the workflow

This optimization removed unnecessary build steps from 122 workflows that don't use the agentic-workflows tool, avoiding wasteful build operations.

Container Predownload Optimization

In dev mode, localhost/gh-aw:dev is NOT added to the predownload list because:

  • The image is built locally in the workflow (not pulled from a registry)
  • Attempting to pull a non-existent image would fail
  • This avoids unnecessary docker pull attempts

Dockerfile Changes

ENTRYPOINT ["gh-aw"]
CMD ["mcp-server", "--cmd", "gh-aw"]

Dev Mode Configuration

Minimal configuration - leverages container's ENTRYPOINT and CMD defaults:

{
  "agentic_workflows": {
    "container": "localhost/gh-aw:dev",
    "mounts": [
      "${{ github.workspace }}:${{ github.workspace }}:rw",
      "/tmp/gh-aw:/tmp/gh-aw:rw"
    ],
    "env": {
      "DEBUG": "*",
      "GH_TOKEN": "\${GH_TOKEN}",
      "GITHUB_TOKEN": "\${GITHUB_TOKEN}"
    }
  }
}

Release Mode Configuration

Full configuration with explicit entrypoint and args:

{
  "agentic_workflows": {
    "container": "alpine:latest",
    "entrypoint": "/opt/gh-aw/gh-aw",
    "entrypointArgs": ["mcp-server"],
    "mounts": [
      "/opt/gh-aw:/opt/gh-aw:ro",
      "/usr/bin/gh:/usr/bin/gh:ro",
      "${{ github.workspace }}:${{ github.workspace }}:rw",
      "/tmp/gh-aw:/tmp/gh-aw:rw"
    ],
    "env": {
      "DEBUG": "*",
      "GH_TOKEN": "\${GH_TOKEN}",
      "GITHUB_TOKEN": "\${GITHUB_TOKEN}"
    }
  }
}

Container Predownload

  • Dev mode: Does NOT download localhost/gh-aw:dev (built locally in workflow)
  • Release mode: Downloads alpine:latest (pulled from Docker Hub)

Build command:

VERSION=$(git describe --tags --always --dirty)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
  -ldflags "-s -w -X main.version=${VERSION}" \
  -o dist/gh-aw-linux-amd64 ./cmd/gh-aw
Original prompt

Update the "agentic-workflows" action mode dev to also import steps to build the CLI.

  • inject steps to setup go, build cli and build docker image (see release.md)
  • update generated mcp server code to use locally built docker image
  • make sure the the gh mount is always mounted for all action modes

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


Changeset

  • Type: patch
  • Description: Document the expanded agentic workflows CLI steps, highlighting the new .github/aw instructions, .github/agents/agentic-workflows dispatcher, and the supporting workflow definitions added in this PR.

Generated by Changeset Generator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI and others added 2 commits February 5, 2026 21:45
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] Update agentic-workflows action mode to build CLI Add CLI build steps for dev mode in agentic-workflows action Feb 5, 2026
Copilot AI requested a review from pelikhan February 5, 2026 21:56
@pelikhan pelikhan added the smoke label Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Changeset Generator failed. Please review the logs for details.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@pelikhan
Copy link
Contributor

pelikhan commented Feb 5, 2026

@copilot you are not creating a release build. use the build command from ci.yml build

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 5, 2026

@copilot you are not creating a release build. use the build command from ci.yml build

Fixed in eca2cbe. The build command now uses the same ldflags as CI/Makefile: -ldflags "-s -w -X main.version=${VERSION}" instead of the release build flags.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.50.1
curl 8.5.0
gh 2.86.0
node 20.20.0
python3 3.12.3
go 1.24.12
java ⚠️ binary present but shell issue
dotnet ⚠️ binary present but shell issue

Result: 10/12 tools fully verified ✅, 2 tools present but untestable due to shell corruption

Note: Java and .NET binaries are present in the container (/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.10-7/x64/bin/java and /usr/share/dotnet/dotnet) but could not be executed due to a bash shell corruption issue during testing. This appears to be a test environment issue rather than a missing tool issue.

AI generated by Agent Container Smoke Test

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 5, 2026

@copilot do not try to pull the locally built image (do not add it to the list of images to pull. it's already there)

Fixed in 55c3c15. In dev mode, localhost/gh-aw:dev is no longer added to the predownload list since it's built locally in the workflow, not pulled from a registry.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Changeset Generator completed successfully!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.50.1
curl 8.5.0
gh 2.86.0
node 20.20.0
python3 3.12.3
go 1.24.12
java 21.0.10*
dotnet 8.0.x*

Result: 12/12 tools available ✅

*Note: Java and dotnet binaries are present and executable but version detection encountered shell environment issues. Java binary confirmed at /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.10-7/x64/bin/java and dotnet at /usr/share/dotnet/dotnet.

AI generated by Agent Container Smoke Test

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Smoke Test Results

✅ PASS - All tests passed

Recent PRs:

Test Status:

  • ✅ GitHub MCP
  • ✅ Safe Inputs GH CLI
  • ✅ Serena MCP (136 symbols found)
  • ✅ Playwright (GitHub page verified)
  • ✅ File Writing
  • ✅ Bash Tool
  • ✅ Discussion Interaction
  • ✅ Build gh-aw
  • ✅ Workflow Dispatch

Run: §21733013111

cc: @pelikhan @Copilot

AI generated by Smoke Copilot

@github-actions github-actions bot removed the smoke label Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@pelikhan pelikhan marked this pull request as ready for review February 5, 2026 23:57
Copilot AI review requested due to automatic review settings February 5, 2026 23:57
Copy link
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 pull request enhances the agentic-workflows action dev mode by implementing local CLI build steps and optimizing the MCP server configuration. The changes enable workflows to build the gh-aw CLI and Docker image locally during execution in dev mode, eliminating the need for external binary mounts while simplifying the configuration.

Changes:

  • Added CLI build steps generation in dev mode for workflows using the agentic-workflows tool
  • Updated MCP server configuration to use locally built Docker image (localhost/gh-aw:dev) in dev mode versus Alpine with mounted binaries in release mode
  • Modified Docker image predownload logic to skip the locally-built image and updated Dockerfile CMD to run MCP server by default

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/constants/constants.go Added DevModeGhAwImage constant for locally built Docker image tag
pkg/workflow/docker.go Updated collectDockerImages() to skip alpine:latest in dev mode since localhost/gh-aw:dev is built locally
pkg/workflow/compiler_yaml_main_job.go Added generateDevModeCLIBuildSteps() function that conditionally generates Go setup, CLI build, Docker Buildx setup, and image build steps
pkg/workflow/mcp_config_builtin.go Refactored renderAgenticWorkflowsMCPConfigWithOptions() and renderAgenticWorkflowsMCPConfigTOML() to use different container images, entrypoints, and mounts based on action mode
pkg/workflow/mcp_renderer.go Updated renderAgenticWorkflowsTOML() to handle dev vs release mode configuration differences
pkg/workflow/mcp_setup_generator.go Updated collectDockerImages() call to pass actionMode parameter
Dockerfile Changed default CMD from ["--help"] to ["mcp-server", "--cmd", "gh-aw"] to align with dev mode container usage
Test files Updated tests to verify dev mode behavior, including new tests for container selection, entrypoint/args absence, mount verification, and environment variables
Lock files (.github/workflows/*.lock.yml) Regenerated 23 workflows with build steps and updated MCP configuration; 122 workflows without agentic-workflows tool remain unchanged
.changeset/patch-document-agentic-workflows-cli.md Added changeset documenting the changes

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

@pelikhan pelikhan merged commit 3b965e4 into main Feb 6, 2026
57 checks passed
@pelikhan pelikhan deleted the copilot/update-agentic-workflows-cli-steps branch February 6, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants