From a324fd37c6cb27d41dacae9109fb21c7cd1a4c95 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 04:17:13 +0000 Subject: [PATCH 1/2] Initial plan From 617a2142c843c3618477c8eb121fa9b2280aa008 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 04:26:34 +0000 Subject: [PATCH 2/2] feat: use action mode for release builds instead of release mode Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/workflow/action_mode.go | 18 ++++++++++-------- pkg/workflow/compiler_action_mode_test.go | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/pkg/workflow/action_mode.go b/pkg/workflow/action_mode.go index acd71931cfe..876d6f75ebe 100644 --- a/pkg/workflow/action_mode.go +++ b/pkg/workflow/action_mode.go @@ -62,9 +62,11 @@ func (m ActionMode) UsesExternalActions() bool { } // DetectActionMode determines the appropriate action mode based on the release flag. -// Returns ActionModeRelease if this binary was built as a release (controlled by the -// isReleaseBuild flag set via -X linker flag at build time), otherwise returns ActionModeDev. -// Can be overridden with GH_AW_ACTION_MODE environment variable or GitHub Actions context. +// Returns ActionModeAction if this binary was built as a release (controlled by the +// isReleaseBuild flag set via -X linker flag at build time), or when running in a +// GitHub Actions release context (release tags, release branches, or release events). +// Returns ActionModeDev for all other cases (PRs, feature branches, local development). +// Can be overridden with GH_AW_ACTION_MODE environment variable. // The version parameter is kept for backward compatibility but is no longer used for detection. func DetectActionMode(version string) ActionMode { actionModeLog.Printf("Detecting action mode: version=%s, isRelease=%v", version, IsRelease()) @@ -82,8 +84,8 @@ func DetectActionMode(version string) ActionMode { // Check if this binary was built as a release using the release flag // This flag is set at build time via -X linker flag and does not rely on version string heuristics if IsRelease() { - actionModeLog.Printf("Detected release mode from build flag (isReleaseBuild=true)") - return ActionModeRelease + actionModeLog.Printf("Detected action mode from build flag (isReleaseBuild=true)") + return ActionModeAction } // Check GitHub Actions context for additional hints @@ -91,15 +93,15 @@ func DetectActionMode(version string) ActionMode { githubEventName := os.Getenv("GITHUB_EVENT_NAME") actionModeLog.Printf("GitHub context: ref=%s, event=%s", githubRef, githubEventName) - // Release mode conditions from GitHub Actions context: + // Conditions that return ActionModeAction from GitHub Actions context: // 1. Running on a release branch (refs/heads/release*) // 2. Running on a release tag (refs/tags/*) // 3. Running on a release event if strings.HasPrefix(githubRef, "refs/heads/release") || strings.HasPrefix(githubRef, "refs/tags/") || githubEventName == "release" { - actionModeLog.Printf("Detected release mode from GitHub context: ref=%s, event=%s", githubRef, githubEventName) - return ActionModeRelease + actionModeLog.Printf("Detected action mode from GitHub context: ref=%s, event=%s", githubRef, githubEventName) + return ActionModeAction } // Default to dev mode for all other cases: diff --git a/pkg/workflow/compiler_action_mode_test.go b/pkg/workflow/compiler_action_mode_test.go index 5ebcf5fbf4a..a149c715818 100644 --- a/pkg/workflow/compiler_action_mode_test.go +++ b/pkg/workflow/compiler_action_mode_test.go @@ -28,22 +28,22 @@ func TestActionModeDetection(t *testing.T) { name: "release tag", githubRef: "refs/tags/v1.0.0", githubEvent: "push", - expectedMode: ActionModeRelease, - description: "Release tags should use release mode", + expectedMode: ActionModeAction, + description: "Release tags should use action mode", }, { name: "release branch", githubRef: "refs/heads/release-1.0", githubEvent: "push", - expectedMode: ActionModeRelease, - description: "Release branches should use release mode", + expectedMode: ActionModeAction, + description: "Release branches should use action mode", }, { name: "release event", githubRef: "refs/heads/main", githubEvent: "release", - expectedMode: ActionModeRelease, - description: "Release events should use release mode", + expectedMode: ActionModeAction, + description: "Release events should use action mode", }, { name: "pull request", @@ -173,8 +173,8 @@ func TestActionModeDetectionWithReleaseFlag(t *testing.T) { isRelease: true, githubRef: "", githubEvent: "", - expectedMode: ActionModeRelease, - description: "Release flag set to true should use release mode", + expectedMode: ActionModeAction, + description: "Release flag set to true should use action mode", }, { name: "release flag false", @@ -189,7 +189,7 @@ func TestActionModeDetectionWithReleaseFlag(t *testing.T) { isRelease: true, githubRef: "refs/heads/main", githubEvent: "push", - expectedMode: ActionModeRelease, + expectedMode: ActionModeAction, description: "Release flag should take precedence over branch", }, { @@ -197,7 +197,7 @@ func TestActionModeDetectionWithReleaseFlag(t *testing.T) { isRelease: false, githubRef: "refs/tags/v1.0.0", githubEvent: "push", - expectedMode: ActionModeRelease, + expectedMode: ActionModeAction, description: "GitHub release tag should still work when release flag is false", }, {