Skip to content

ci: fix CRLF line endings in shell scripts#46

Open
rivetphilbot wants to merge 2 commits into
1CatAI:mainfrom
rivetphilbot:fix-ci-cleanup-pr-body-crlf
Open

ci: fix CRLF line endings in shell scripts#46
rivetphilbot wants to merge 2 commits into
1CatAI:mainfrom
rivetphilbot:fix-ci-cleanup-pr-body-crlf

Conversation

@rivetphilbot
Copy link
Copy Markdown

@rivetphilbot rivetphilbot commented May 19, 2026

Problem

The Cleanup PR Body workflow (update-description) fails on every PR. .github/scripts/cleanup_pr_body.sh is committed with CRLF line endings, and on the Linux Actions runner bash interprets the trailing \r as part of each command:

cleanup_pr_body.sh: line 2: $'\r': command not found
cleanup_pr_body.sh: line 3: set: - : invalid option
cleanup_pr_body.sh: line 51: syntax error: unexpected end of file

The same CRLF issue affects the four .github/workflows/scripts/ scripts (build.sh, cuda-install.sh, env.sh, pytorch-install.sh), which fail identically when their workflows run on a Linux runner.

Fix

  • Convert cleanup_pr_body.sh and the four .github/workflows/scripts/ scripts to LF. The whole-file diffs are purely the line-ending change — bash -n passes on all five after conversion.
  • Add .gitattributes (*.sh text eol=lf) so shell scripts are stored with LF going forward and the issue does not regress.

Note on scope

This PR is scoped to the five CI-critical scripts. For full context: all 89 tracked .sh files in the repo are currently CRLF (.buildkite/, examples/, tools/, etc.). The .gitattributes added here declares the LF intent repo-wide but does not rewrite the other 84 files — a one-shot git add --renormalize . would do that cleanly if you want it, but that is a maintainer call and kept out of this PR to keep the diff reviewable.

The 'Cleanup PR Body' workflow fails on every PR because
cleanup_pr_body.sh is committed with CRLF line endings. On the Linux
Actions runner bash reads the trailing \r as part of each command:

  cleanup_pr_body.sh: line 2: $'\r': command not found
  cleanup_pr_body.sh: line 3: set: - : invalid option
  cleanup_pr_body.sh: line 51: syntax error: unexpected end of file

Convert the script to LF so it runs on the runner.
build.sh, cuda-install.sh, env.sh and pytorch-install.sh were committed
with CRLF line endings, so they fail the same way as cleanup_pr_body.sh
when their workflows run on a Linux runner (bash reads $'\r' as part of
each command).

Add a .gitattributes (*.sh text eol=lf) so shell scripts are stored with
LF going forward and the issue does not regress.
@rivetphilbot rivetphilbot changed the title ci: fix CRLF line endings in cleanup_pr_body.sh ci: fix CRLF line endings in shell scripts May 19, 2026
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