Skip to content

Comments

Fix base64 executable not found on Windows in gh aw update#17720

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-base64-executable-error
Feb 22, 2026
Merged

Fix base64 executable not found on Windows in gh aw update#17720
pelikhan merged 3 commits intomainfrom
copilot/fix-base64-executable-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 22, 2026

gh aw update fails on Windows because downloadWorkflowContent shells out to the base64 binary (unavailable on Windows) to decode GitHub API responses.

Changes

  • pkg/cli/download_workflow.go: Replace exec.Command("base64", "-d") with Go's stdlib encoding/base64.StdEncoding.DecodeString(), extracting the logic into a decodeBase64FileContent helper that strips embedded newlines the GitHub API includes in its base64 payload before decoding.

  • pkg/cli/download_workflow_test.go: Added unit tests for decodeBase64FileContent covering plain base64, GitHub API-style newline-wrapped content, leading/trailing whitespace stripping, binary content round-trips, and invalid input error handling.

// Before — shells out to external binary, breaks on Windows
base64Cmd := exec.Command("base64", "-d")
base64Cmd.Stdin = strings.NewReader(contentBase64)
content, err := base64Cmd.Output()

// After — pure Go, cross-platform
func decodeBase64FileContent(raw string) ([]byte, error) {
    cleaned := strings.ReplaceAll(strings.TrimSpace(raw), "\n", "")
    return base64.StdEncoding.DecodeString(cleaned)
}
Original prompt

This section details on the original issue you should resolve

<issue_title>"base64": executable file not found in %PATH%</issue_title>
<issue_description>
ran: gh extensions upgrade github/gh-aw

upgraded from v0.47.3 to v0.48.4

ran: gh aw upgrade

upgrade complete

ran: gh aw update

i get the error failed to download workflow: failed to decode file content: exec: "base64": executable file not found in %PATH% for all my workflows</issue_description>

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


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

…s compatibility

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix base64 executable file not found error in workflows Fix base64 executable not found on Windows in gh aw update Feb 22, 2026
Copy link
Contributor

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

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

@copilot add tests

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

Copilot AI commented Feb 22, 2026

@copilot add tests

Added in 1aafa81. Extracted the decoding logic into a decodeBase64FileContent helper and added download_workflow_test.go with 5 table-driven tests covering: plain base64, GitHub API-style newline-wrapped content, leading/trailing whitespace, binary content round-trip, and invalid input returning an error.

@pelikhan pelikhan marked this pull request as ready for review February 22, 2026 13:51
Copilot AI review requested due to automatic review settings February 22, 2026 13:51
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 PR fixes a Windows compatibility issue where gh aw update fails because it shells out to the base64 command-line utility, which is not available on Windows by default. The fix replaces the external base64 command with Go's standard library encoding/base64 package for cross-platform compatibility.

Changes:

  • Replaced shell command execution for base64 decoding with Go stdlib implementation
  • Added comprehensive unit tests covering various edge cases including GitHub API-style newline wrapping
  • Extracted decoding logic into a dedicated decodeBase64FileContent helper function

Reviewed changes

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

File Description
pkg/cli/download_workflow.go Replaced exec.Command("base64", "-d") with stdlib base64.StdEncoding.DecodeString() and added decodeBase64FileContent helper that handles GitHub API's 60-character line wrapping
pkg/cli/download_workflow_test.go Added comprehensive unit tests for the new decodeBase64FileContent function covering plain base64, newline-wrapped content, whitespace handling, binary data, and error cases

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

@pelikhan pelikhan merged commit 8461cb6 into main Feb 22, 2026
120 checks passed
@pelikhan pelikhan deleted the copilot/fix-base64-executable-error branch February 22, 2026 13:57
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.

"base64": executable file not found in %PATH%

2 participants