Skip to content

Fix includeIf case sensitivity on Windows self-hosted runners#2425

Open
salmanmkc wants to merge 1 commit into
mainfrom
fix-windows-includeif-case-sensitivity
Open

Fix includeIf case sensitivity on Windows self-hosted runners#2425
salmanmkc wants to merge 1 commit into
mainfrom
fix-windows-includeif-case-sensitivity

Conversation

@salmanmkc

@salmanmkc salmanmkc commented May 6, 2026

Copy link
Copy Markdown
Contributor

On Windows, includeIf.gitdir: does case-sensitive path matching even though the filesystem is case-insensitive. When a self-hosted Windows runner has a pre-existing workspace folder with different casing than what the runner config specifies (e.g. D:\Workspaces on disk vs D:\workspaces in config), the includeIf condition never matches and git auth silently fails.

This was introduced in v6 with the move to credential isolation via includeIf (#2286). v5 did not use includeIf so it was never an issue. GitHub-hosted runners are not affected since they use a lowercase workspace folder.

Git already has a case-insensitive variant: gitdir/i: (available since 2.13.0, well before our minimum of 2.18). This PR switches to gitdir/i: on Windows while keeping gitdir: on Linux/macOS where case sensitivity is expected.

Also updates the cleanup regex to handle both variants so credential removal still works.

Fixes #2345

Copilot AI review requested due to automatic review settings May 6, 2026 12:17
@salmanmkc salmanmkc force-pushed the fix-windows-includeif-case-sensitivity branch from 9979a83 to c0c6be9 Compare May 6, 2026 12:20

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 a Windows-only regression where includeIf.gitdir: path matching is case-sensitive, causing credential include rules to fail when GITHUB_WORKSPACE casing differs from the on-disk path casing. It does so by using Git’s case-insensitive gitdir/i: condition on Windows while keeping existing behavior on other platforms.

Changes:

  • Introduces a platform-dependent INCLUDE_IF_GITDIR prefix (includeIf.gitdir/i: on Windows, includeIf.gitdir: elsewhere).
  • Updates all includeIf key construction sites to use the new prefix.
  • Updates the cleanup key-regex to remove both gitdir: and gitdir/i: includeIf entries.
Show a summary per file
File Description
src/git-auth-helper.ts Adds a Windows-specific includeIf.gitdir/i: prefix and broadens cleanup matching to handle both variants.
dist/index.js Regenerates the bundled output to reflect the TypeScript source changes.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/2 changed files
  • Comments generated: 1
Comment thread src/git-auth-helper.ts
Comment on lines 15 to +20
const IS_WINDOWS = process.platform === 'win32'
// Use case-insensitive gitdir matching on Windows to handle path casing mismatches
// between the runner's GITHUB_WORKSPACE and the actual filesystem casing.
// See: https://github.com/actions/checkout/issues/2345
const INCLUDE_IF_GITDIR = IS_WINDOWS
? 'includeIf.gitdir/i:'
@salmanmkc salmanmkc changed the title Use case-insensitive includeIf.gitdir on Windows May 6, 2026
@salmanmkc salmanmkc force-pushed the fix-windows-includeif-case-sensitivity branch from c0c6be9 to 6e134d0 Compare May 6, 2026 12:22
Switch to includeIf.gitdir/i: on Windows so path matching is
case-insensitive, matching the filesystem behavior. This fixes
auth failures on self-hosted Windows runners where the workspace
folder casing doesn't match between the runner config and disk.

Also update the cleanup regex to handle both gitdir: and gitdir/i:
variants.

Fixes #2345
@salmanmkc salmanmkc force-pushed the fix-windows-includeif-case-sensitivity branch from 6e134d0 to be385d8 Compare May 6, 2026 12:27
@ericsciple ericsciple self-requested a review May 6, 2026 19:00
trek-e added a commit to open-gsd/gsd-core that referenced this pull request May 28, 2026
…PT_ACTIONS_TO_NODE24 (node20 EOL) (#446)

Problem: Node 20 deprecation warnings fired on every CI run. Despite
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true in test.yml (added in PR #350),
the warning is not silenced — the env var only changes which warning fires
(both paths call context.Warning()). The only silent path is for the action
itself to declare `using: node24`.
Ref: https://github.com/actions/runner/blob/main/src/Runner.Common/Util/NodeUtil.cs
Ref: https://github.com/actions/runner/blob/main/src/Runner.Worker/JobExtension.cs

Three locations used @v4 actions (node20 runtime):

1. test.yml — Windows lanes (test + test-full jobs) pinned to
   actions/checkout@11bd719 (v4.2.2).
   Original pin rationale (PR #162 / issue #161): v6 uses includeIf.gitdir:
   for auth injection, which is unreliable on Windows git 2.54.
   v5 never used includeIf, so it is safe for Windows.
   Upstream confirmation: actions/checkout#2425
   v5 action.yml declares `using: node24`: https://raw.githubusercontent.com/actions/checkout/v5/action.yml

2. changeset-required.yml — floating actions/checkout@v4 + actions/setup-node@v4

3. docs-required.yml — same floating @v4 pattern

Changes:
- test.yml: both Windows checkout steps v4.2.2 → v5.0.1
  (SHA 11bd71901bbe5b1630ceea73d27597364c9af683 → 93cb6efe18208431cddfb8368fd83d5badbf9bfd)
- test.yml: update comment on Windows checkout to reflect v5 rationale
- test.yml: no FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 was present on origin/next
  (already absent; the env block was on the main-branch version only)
- changeset-required.yml: actions/checkout@v4 → @93cb6efe18208431cddfb8368fd83d5badbf9bfd (v5.0.1)
- changeset-required.yml: actions/setup-node@v4 → @a0853c24544627f65ddf259abe73b1d18a591444 (v5.0.0)
- docs-required.yml: same as changeset-required.yml

SHAs resolved from upstream tags:
- checkout v5.0.1: gh api repos/actions/checkout/git/ref/tags/v5.0.1 → 93cb6efe18208431cddfb8368fd83d5badbf9bfd
- setup-node v5.0.0: gh api repos/actions/setup-node/git/ref/tags/v5.0.0 → a0853c24544627f65ddf259abe73b1d18a591444

Closes #445

Co-authored-by: CI Rebase Check <ci@gsd-redux>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants