Skip to content

Replace branch checkout commands with git switch in setup action#5

Merged
mmathieum merged 1 commit into
masterfrom
copilot/replace-git-checkout-with-git-switch
Apr 16, 2026
Merged

Replace branch checkout commands with git switch in setup action#5
mmathieum merged 1 commit into
masterfrom
copilot/replace-git-checkout-with-git-switch

Conversation

Copilot AI commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

This updates branch transitions in the composite setup action to use git switch instead of git checkout. The change is scoped to branch selection paths and leaves non-branch checkout behavior unchanged.

  • Scope

    • Updated branch fallback logic in .github/actions/setup/action.yml for:
      • submodule branch selection ($MT_BRANCH_NAME$MT_TARGET_BRANCH_NAME$MT_DEFAULT_BRANCH_NAME)
      • repository branch selection ($MT_BRANCH_NAME$MT_TARGET_BRANCH_NAME)
  • Behavior preserved

    • SHA-based detached checkout remains unchanged:
      • git -C $REPOSITORY_NAME checkout $MT_SHA
  • Representative change

    # before
    git checkout $MT_BRANCH_NAME || git checkout $MT_TARGET_BRANCH_NAME
    
    # after
    git switch $MT_BRANCH_NAME || git switch $MT_TARGET_BRANCH_NAME

@mmathieum

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request replaces git checkout with git switch in the GitHub Action setup script for both submodules and the main repository. The review feedback suggests quoting the environment variables to properly handle branch names with special characters or spaces and highlights that git switch improves the robustness of the fallback logic when variables are empty.

Comment thread .github/actions/setup/action.yml
Comment thread .github/actions/setup/action.yml
@mmathieum mmathieum merged commit d9c1181 into master Apr 16, 2026
@mmathieum mmathieum deleted the copilot/replace-git-checkout-with-git-switch branch April 16, 2026 14:35
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