Skip to content

DecimalTurn/Enforce-CRLF

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

A simple GitHub Action to enforce CRLF on selected file types in your repo.

Example worflow:

Path: /.github/workflows/enforce-crlf.yml

name: Force CRLF for files inside the Git index

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

permissions:
  contents: write

jobs:
  enforce-crlf:
    runs-on: ubuntu-latest
    steps:
    - name: Enforce CRLF action
      uses: DecimalTurn/Enforce-CRLF@2b2f7b4f08a0d4f380f2d8be6b42e7d46e076065 #v1.2.0
      with:
        extensions: .bas, .frm, .cls
        do-checkout: true
        do-push: true

Note that in the above example, we are setting do-checkout and do-push in order to let Enforce-CRLF perform those steps for us. If however, you want Enforce-CRLF to be part of a more complex workflow where you've already performed the git checkout and/or will perform the git push at the end, you can always set those values to false.

      with:
        extensions: .bas, .frm, .cls
        do-checkout: false
        do-push: false

If you want the workflow to fail (and not auto-fix) when files with LF endings are found, set fail-on-lf: true:

      with:
        extensions: .bas, .frm, .cls
        do-checkout: true
        fail-on-lf: true

When fail-on-lf is enabled, the action will check for files needing CRLF conversion and fail the workflow if any are found, without modifying them. This is useful to get alerted if a PR introduces LF line endings in files that should be CRLF, but it doesn't require the action to modify the files, so you don't need to give it write permissions.

About

A simple GitHub Action to enforce CRLF line endings on selected file types in your repo.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages