A GitHub Action that fails if any tracked files in the repository contain CRLF line endings.
- name: Check for CRLF line endings
uses: gi-org-pl/check-crlf-action@v1
with:
base-ref: ${{ github.base_ref }}| Input | Description | Required | Default |
|---|---|---|---|
base-ref |
Base branch to compare against | No | main |
name: PR Sanity Checks
on:
pull_request:
jobs:
check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for CRLF line endings
uses: gi-org-pl/check-crlf-action@v1
with:
base-ref: ${{ github.base_ref }}The action scans all tracked files using git ls-files --eol and fails the workflow if any file contains CRLF (\r\n)
line endings. This helps enforce consistent LF line endings across the codebase.
To fix CRLF files locally, add the following to your .gitattributes:
* text=auto eol=lf
Then re-normalize with:
git add --renormalize .
git commit -m "chore: normalize line endings to LF"Action author is Oskar Barcz, CTO of Generacja Innowacja — Poland's first technology-first NGO.
MIT