Skip to content

Add .gitattributes to fix Windows CI prettier format-check failure#826

Merged
alexarchambault merged 1 commit into
mainfrom
copilot/fix-cache-action-issue
May 12, 2026
Merged

Add .gitattributes to fix Windows CI prettier format-check failure#826
alexarchambault merged 1 commit into
mainfrom
copilot/fix-cache-action-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Fixes the Windows CI failure at https://github.com/coursier/cache-action/actions/runs/25727659691/job/75544511285.

Root cause

On Windows, Git's default behavior is to convert LF line endings to CRLF on checkout. When prettier --check **/*.ts runs, it expects LF (the prettier v3 default), so it fails on the CRLF files.

The workflow already tries to work around this with test "$OSTYPE" != "msys" || npm run format, but this is unreliable: npm scripts on Windows use cmd.exe internally, and the interaction between the bash runner shell and npm's cmd.exe invocation can cause the glob **/*.ts to not reliably match and rewrite the files before the check runs.

Fix

Add a .gitattributes file that forces LF line endings on all platforms:

* text=auto eol=lf

This prevents Git from converting line endings to CRLF on Windows checkout, so the files will always have LF endings and prettier --check will pass consistently.

Agent-Logs-Url: https://github.com/coursier/cache-action/sessions/71878b1f-b91d-475b-989b-99776512f028

Co-authored-by: alexarchambault <7063723+alexarchambault@users.noreply.github.com>
Copilot AI requested a review from alexarchambault May 12, 2026 10:15
@alexarchambault alexarchambault marked this pull request as ready for review May 12, 2026 10:21
@alexarchambault alexarchambault merged commit 95b07c5 into main May 12, 2026
4 checks passed
@alexarchambault alexarchambault deleted the copilot/fix-cache-action-issue branch May 12, 2026 10:21
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