Fix CRLF Endings #138
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yamllint disable rule:line-length | |
--- | |
# This workflow finds and fixes CRLF endings in a repository | |
name: Fix CRLF Endings | |
on: | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
fix-crlf: | |
name: Fix CRLF Endings | |
runs-on: ubuntu-latest # Use a Linux runner | |
steps: | |
- name: Checkout repository contents | |
uses: actions/checkout@v4 # Use the checkout action | |
- name: Find files with CRLF endings | |
uses: erclu/[email protected] # Use the check-crlf action | |
id: check-crlf # Assign an id to this step | |
with: | |
# Specify the paths to check | |
path: | | |
./* | |
!.git | |
!*.png | |
!*.jpg | |
!*.bin | |
- name: Apply dos2unix to files with CRLF endings | |
run: | | |
# Loop through each file and apply dos2unix | |
# shellcheck disable=SC2043 | |
for f in ${{ steps.check-crlf.outputs.files }}; do | |
# Apply dos2unix and keep the original timestamp | |
dos2unix -k "$f" | |
done | |
- name: Commit if needed | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "Github bot : CRLF corrected" | |
default_author: github_actions |