Skip to content

Fix gen-commands PATH resolution in GitHub Actions workflow - #11

Closed
gregmankes with Copilot wants to merge 5 commits into
developfrom
copilot/fix-github-actions-path
Closed

Fix gen-commands PATH resolution in GitHub Actions workflow#11
gregmankes with Copilot wants to merge 5 commits into
developfrom
copilot/fix-github-actions-path

Conversation

Copilot AI commented Feb 6, 2026

Copy link
Copy Markdown

The verify-generation job was failing because gen-commands installed via go install was not in PATH when make gen executed.

Changes

  • Added Go setup: Both jobs now use actions/setup-go@v5 with go-version-file: 'go.mod' to ensure Go 1.25.3 is available
  • Added PATH configuration: Append $HOME/go/bin to $GITHUB_PATH before running make gen so binaries installed by go install are discoverable
  • Added explicit permissions: Both jobs now specify permissions: contents: read to follow least-privilege security practices
- name: Set up Go
  uses: actions/setup-go@v5
  with:
    go-version-file: 'go.mod'
- name: Add Go bin to PATH
  run: echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Run commands generation command
  run: make gen

The Makefile's install target clones the temporal CLI repo and runs go install ./cmd/gen-commands, which installs to $GOPATH/bin (typically ~/go/bin). This directory is not in the default GitHub Actions runner PATH.

Original prompt

Problem

The GitHub Actions workflow is failing because gen-commands binary installed via go install is not found in the PATH. The failure occurs in the "Check Generated Files" workflow at this job: https://github.com/temporalio/cloud-cli/actions/runs/21757553412/job/62771977077

Error Log

2026-02-06T16:18:43.0870158Z gen-commands -input ./temporalcloudcli/commands.yml -pkg temporalcloudcli > ./temporalcloudcli/commands.gen.go
2026-02-06T16:18:43.0883189Z /bin/sh: 1: gen-commands: not found
2026-02-06T16:18:43.0883854Z make: *** [Makefile:20: gen] Error 127

Root Cause

The Makefile's install rule runs go install ./cmd/gen-commands which installs the binary to $GOPATH/bin (typically ~/go/bin), but this directory is not in the PATH for the GitHub Actions runner.

Solution

Add a step in the .github/workflows/build.yml file to add the Go bin directory to the GitHub Actions PATH before running make gen.

In the verify-generation job, add a new step after the checkout step:

- name: Add Go bin to PATH
  run: echo "$HOME/go/bin" >> $GITHUB_PATH

This step should be inserted between the "Checkout repository" step and the "Run commands generation command" step (between lines 15 and 16).

Files to Modify

  • .github/workflows/build.yml - Add the new step to add Go bin to PATH in the verify-generation job

This pull request was created from Copilot chat.


✨ 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 February 6, 2026 16:25
Co-authored-by: gregmankes <8827475+gregmankes@users.noreply.github.com>
…ound error

Co-authored-by: gregmankes <8827475+gregmankes@users.noreply.github.com>
@gregmankes
gregmankes changed the base branch from main to develop February 6, 2026 16:26
…dback

Co-authored-by: gregmankes <8827475+gregmankes@users.noreply.github.com>
Comment on lines +30 to +36
runs-on: ubuntu-latest
needs: verify-generation
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Build the cli binary
run: make build

@semgrep-managed-scans semgrep-managed-scans Bot Feb 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No explicit GITHUB_TOKEN permissions found at the workflow or job level. Add a permissions: block at the workflow root (applies to all jobs) or per job with least privilege (e.g., contents: read and only specific writes like pull-requests: write if needed).

🥳 Fixed in commit ebd44de 🥳

Comment on lines +12 to +28
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Run commands generation command
run: make gen
- name: Verify no changes were generated
run: |
# Check if there are any uncommitted changes in the working directory
if [ -z "$(git status --porcelain)" ]; then
echo "::notice::Generated files are up to date. No changes detected."
else
echo "::error::Detected uncommitted changes after running the generation command. Please run the generator and commit the changes."
git status
git diff
exit 1
fi

@semgrep-managed-scans semgrep-managed-scans Bot Feb 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No explicit GITHUB_TOKEN permissions found at the workflow or job level. Add a permissions: block at the workflow root (applies to all jobs) or per job with least privilege (e.g., contents: read and only specific writes like pull-requests: write if needed).

🍰 Fixed in commit ebd44de 🍰

Co-authored-by: gregmankes <8827475+gregmankes@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix GitHub Actions workflow by adding Go bin to PATH Fix gen-commands PATH resolution in GitHub Actions workflow Feb 6, 2026
Copilot AI requested a review from gregmankes February 6, 2026 16:30
@gregmankes gregmankes closed this Feb 6, 2026
@gregmankes
gregmankes deleted the copilot/fix-github-actions-path branch February 6, 2026 17:00
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