Skip to content

Resolves issue creating release with 'prerelease' tag#6392

Merged
wbreza merged 3 commits into
Azure:mainfrom
wbreza:bug-6391
Dec 17, 2025
Merged

Resolves issue creating release with 'prerelease' tag#6392
wbreza merged 3 commits into
Azure:mainfrom
wbreza:bug-6391

Conversation

@wbreza

@wbreza wbreza commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

Resolves #6391

  • Fixes release error when using --prerelease flag
  • Ensures build sets executable permissions for use on POSIX systems

@wbreza wbreza enabled auto-merge (squash) December 17, 2025 19:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 issue #6391 by correcting how boolean flags are passed to the GitHub CLI when creating releases. The previous implementation incorrectly passed boolean flags with values (e.g., --prerelease true), but the GitHub CLI expects boolean flags to be passed without values (e.g., --prerelease). The PR also includes an unrelated improvement to ensure binary file executability after copying.

Key Changes:

  • Fixed boolean flag handling in GitHub release creation to pass flags without values
  • Added execute permissions to copied extension binaries to ensure they are executable

Reviewed changes

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

File Description
cli/azd/extensions/microsoft.azd.extensions/internal/github/github.go Refactored CreateRelease to separate boolean flags (prerelease, draft) from value-based flags, ensuring GitHub CLI receives correct flag format
cli/azd/extensions/microsoft.azd.extensions/internal/cmd/build.go Added os.Chmod call to set execute permissions (0755) on copied binary files
Comments suppressed due to low confidence (1)

cli/azd/extensions/microsoft.azd.extensions/internal/github/github.go:184

  • The CreateRelease function has been modified to fix a critical bug with boolean flag handling, but there are no tests covering this functionality. Consider adding tests to verify that:
  1. Boolean flags like 'prerelease' and 'draft' are correctly added without values when set to "true"
  2. Boolean flags are not added to the command when set to other values or not present
  3. Non-boolean flags continue to work correctly with their values

This would prevent regressions in the future and document the expected behavior.

func (gh *GitHubCli) CreateRelease(cwd string, tagName string, opts map[string]string, assets []string) (*Release, error) {
	args := []string{"release", "create", tagName}

	// Define boolean flags that should be added without values
	booleanFlags := map[string]bool{"prerelease": true, "draft": true}

	// Add optional arguments (skip boolean flags)
	for key, value := range opts {
		if value != "" && !booleanFlags[key] {
			args = append(args, fmt.Sprintf("--%s", key), value)
		}
	}

	// Add boolean flags (without values)
	for flag := range booleanFlags {
		if value, ok := opts[flag]; ok && value == "true" {
			args = append(args, fmt.Sprintf("--%s", flag))
		}
	}

Comment thread cli/azd/extensions/microsoft.azd.extensions/internal/cmd/build.go
@wbreza wbreza merged commit 0549f70 into Azure:main Dec 17, 2025
18 checks passed
@wbreza wbreza deleted the bug-6391 branch December 17, 2025 19:27
Copilot AI added a commit that referenced this pull request Dec 17, 2025
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
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.

Error releasing extension with --prerelease flag

3 participants