Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthri committed Jul 24, 2023
2 parents 83b660f + 83f969e commit 41d0f01
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
author: Arthri
name: Check End-of-Line Sequences
description: "Checks text files' end-of-line sequences."

inputs:
default-eol:
default: lf
description: Specifies the default end-of-line sequence. The supported values are "lf"(default), "crlf", and "mixed".
required: false

runs:
using: composite
steps:
- name: Check End-of-Line Sequences
shell: bash
env:
DEFAULT_EOL: ${{ inputs.default-eol }}
run: |
exit_code=0
while IFS= read line; do
if [[ $line =~ ^i/([^ ]*)\ +w/[^\ ]*\ +attr/[^$'\t']+$'\t'(.+)$ ]] ; then
index_eol=${BASH_REMATCH[1]}
if [ "$index_eol" != $DEFAULT_EOL ] ; then
echo "${BASH_REMATCH[2]}:"$'\t'"End-of-line sequence in index($index_eol) must be LF."
exit_code=1
fi
else
echo 'Unable to match '"$line"
exit_code=1
fi
done < <(git ls-files --eol)
exit $exit_code

0 comments on commit 41d0f01

Please sign in to comment.