Is actions/checkout Compatible with Linux, Windows, and macOS Runners?

actions/checkout is fully compatible with Linux, Windows, and macOS runners because it runs on the Node.js runtime bundled with GitHub-hosted runners, using platform-agnostic Git commands via the @actions/exec API.

The actions/checkout action is engineered to work seamlessly across all GitHub-hosted runner operating systems without requiring workflow modifications. Written in TypeScript and compiled to JavaScript, the action leverages the pre-installed Node runtime and Git binaries present on Ubuntu, Windows, and macOS runners to perform repository checkouts identically on every platform.

How actions/checkout Achieves Cross-Platform Compatibility

The action relies on the Node.js runtime that GitHub includes in all hosted runner images. Because the core logic executes within this JavaScript environment rather than through OS-specific shell commands, the same code runs on ubuntu-latest, windows-latest, and macos-latest without modification.

All Git operations are performed through the @actions/exec API, which spawns the native git binary supplied by the runner. This abstraction ensures that commands execute using the platform's native Git installation while the action itself remains OS-agnostic.

Platform-Specific Implementation Details

While the action is designed to be universal, the source code contains minimal platform-specific branches guarded by process.platform detection.

Windows Path Normalization in git-auth-helper.ts

In src/git-auth-helper.ts, the constant IS_WINDOWS is defined when process.platform === 'win32' (lines 15-16). When this flag is true, the helper normalizes Windows-style backslashes to forward slashes:

// From src/git-auth-helper.ts lines 180-182
submoduleGitDir = submoduleGitDir.replace(/\\/g, '/')

This normalization ensures consistent path handling when the action configures Git authentication credentials on Windows runners.

POSIX Handling for Linux and macOS

On Linux and macOS runners, the same code paths execute but skip the Windows-specific normalization step. The IS_WINDOWS check prevents path manipulation on POSIX systems, allowing natural forward-slash path handling to remain unchanged.

Environment Variable Management

The action temporarily overrides the $HOME environment variable when configuring temporary Git credentials, as implemented in the configureTempGlobalConfig function (lines 85-92 of src/git-auth-helper.ts). This technique works identically across all platforms because Node.js handles environment variable assignment consistently regardless of the underlying operating system.

CI Validation Across Operating Systems

The repository's continuous integration workflow (.github/workflows/test.yml) validates cross-platform compatibility by executing the full test suite on all three supported runner images:

  • ubuntu-latest (Linux)
  • windows-latest (Windows)
  • macos-latest (macOS)

Each job installs the action and runs the same unit tests (including __test__/git-auth-helper.test.ts), confirming that credential configuration, path handling, and Git operations function correctly on every OS. The entry point in src/main.ts registers problem matchers and invokes checkout logic that has been verified to behave identically across this entire matrix.

Usage Examples for Each Runner OS

You can use the identical workflow syntax regardless of the runner operating system. The action automatically adapts to the environment:


# Linux runner

name: Checkout on Linux
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7

# Windows runner

name: Checkout on Windows
on: [push]
jobs:
  build:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v7

# macOS runner

name: Checkout on macOS
on: [push]
jobs:
  build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v7

The only difference between these configurations is the runs-on value; the action reference and behavior remain constant.

Summary

  • actions/checkout works out-of-the-box on Ubuntu, Windows, and macOS runners without platform-specific configuration.
  • Platform detection is minimal, limited to the IS_WINDOWS constant in src/git-auth-helper.ts for path normalization.
  • Git operations are abstracted through @actions/exec, which calls the runner's native Git binary.
  • Cross-platform validation is enforced by the upstream CI workflow testing against ubuntu-latest, windows-latest, and macos-latest.
  • Environment handling uses Node.js APIs that behave consistently across Linux, Windows, and macOS.

Frequently Asked Questions

Does actions/checkout require shell commands specific to Linux?

No. The action does not contain OS-specific shell commands. All Git operations are performed via the @actions/exec API, which spawns the native git binary supplied by the runner. The logic in src/git-command-manager.ts handles command execution abstractly, ensuring compatibility with Windows Command Prompt, PowerShell, and POSIX shells alike.

Are there performance differences between Windows and Linux runners?

While actions/checkout itself executes with the same speed on all platforms, repository checkout performance may vary based on the runner's file system and Git implementation. The action's code path is identical across operating systems, but Windows runners typically exhibit different I/O characteristics compared to Linux or macOS runners due to underlying file system architecture.

Does the action handle line endings differently on Windows?

The action does not explicitly configure line ending conversions. Git's core.autocrlf settings on the runner determine line ending behavior. The actions/checkout action focuses on repository retrieval and credential management, leaving line ending normalization to the Git configuration present on the specific runner operating system.

Can I use actions/checkout on self-hosted runners with custom OS configurations?

Yes, provided the self-hosted runner has Node.js and Git installed. The action requires the Node runtime (bundled with GitHub-hosted runners) and access to a git binary in the system PATH. As long as these dependencies exist, actions/checkout functions identically on self-hosted Linux, Windows, and macOS runners regardless of custom configurations.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →