Skip to content

Use release flag instead of version heuristics for action mode detection#7433

Merged
pelikhan merged 3 commits intomainfrom
copilot/implement-checkout-actions-logic
Dec 23, 2025
Merged

Use release flag instead of version heuristics for action mode detection#7433
pelikhan merged 3 commits intomainfrom
copilot/implement-checkout-actions-logic

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

The "Checkout actions folder" step should be emitted in non-release builds based on the isReleaseBuild flag set at build time, not by parsing version strings.

Changes

  • pkg/workflow/action_mode.go: Replace version string heuristics in DetectActionMode() with IsRelease() check

    • Before: Parsed version for v* prefix, -dirty suffix, etc.
    • After: Checks isReleaseBuild flag set via -X linker flag at build time
    • Preserves environment override (GH_AW_ACTION_MODE) and GitHub context detection as fallbacks
  • pkg/workflow/compiler_action_mode_test.go: Add TestActionModeDetectionWithReleaseFlag() covering release flag behavior with environment overrides and GitHub context

Detection priority

  1. Environment variable GH_AW_ACTION_MODE
  2. Build-time isReleaseBuild flag
  3. GitHub Actions context (release tags/branches)
  4. Default to dev mode

Example

// Before: parsed version string
if version != "" && version != "dev" && !strings.Contains(version, "-dirty") && strings.HasPrefix(version, "v") {
    return ActionModeRelease
}

// After: uses build-time flag
if IsRelease() {
    return ActionModeRelease
}
Original prompt

The "Checkout actions folder" should be emitted when building from a non-release build. The release build is controlled by the release flag that is only enabled in the release build. Make sure this logic is implemented correctly and that it does not rely on heuristics parsing the version number.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 23, 2025 19:46
Copilot AI changed the title [WIP] Implement checkout actions logic for non-release builds Use release flag instead of version heuristics for action mode detection Dec 23, 2025
Copilot AI requested a review from pelikhan December 23, 2025 19:54
@pelikhan pelikhan marked this pull request as ready for review December 23, 2025 19:55
@pelikhan pelikhan merged commit a22b348 into main Dec 23, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/implement-checkout-actions-logic branch December 23, 2025 19:55
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