Skip to content

Commit

Permalink
ci(lint): flag crlf line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
OnkarRuikar committed Dec 29, 2024
1 parent 2bb6de0 commit b98ad3c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/pr-check-lint_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ jobs:
files_to_lint="$DIFF_DOCUMENTS"
echo "crlf line ending check"
CRLF_FAILED=true
CRLF_LOG=$(git ls-files --eol ${files_to_lint} | grep -E 'w/(mixed|crlf)') || CRLF_FAILED=false
echo "CRLF_LOG<<${EOF}" >> $GITHUB_ENV
echo "${CRLF_LOG}" >> $GITHUB_ENV
echo "${EOF}" >> $GITHUB_ENV
echo "CRLF_FAILED=${CRLF_FAILED}" >> $GITHUB_ENV
echo "Running markdownlint --fix"
MD_LINT_FAILED=false
MD_LINT_LOG=$(yarn markdownlint-cli2 --fix ${files_to_lint} 2>&1) || MD_LINT_FAILED=true
Expand Down Expand Up @@ -154,17 +162,24 @@ jobs:
-reporter="github-pr-review"
- name: Fail if any issues pending
if: ${{ env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true' }}
if: ${{ env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true' || env.CRLF_FAILED == 'true' || env.PRETTIER_FAILED == 'true' }}
env:
CRLF_FAILED: ${{ env.CRLF_FAILED }}
MD_LINT_FAILED: ${{ env.MD_LINT_FAILED }}
FM_LINT_FAILED: ${{ env.FM_LINT_FAILED }}
PRETTIER_FAILED: ${{ env.PRETTIER_FAILED }}
CRLF_LOG: ${{ env.CRLF_LOG }}
MD_LINT_LOG: ${{ env.MD_LINT_LOG }}
FM_LINT_LOG: ${{ env.FM_LINT_LOG }}
PRETTIER_LOG: ${{ env.PRETTIER_LOG }}
run: |
echo -e "\nPlease fix all the linting issues mentioned in the following logs and in the PR review comments."
if [[ ${CRLF_FAILED} == 'true' ]]; then
echo -e "\n\n🪵 In the following files make sure all the lines ends with 'lf' character and not 'crlf' characters:"
echo "${CRLF_LOG}"
fi
if [[ ${MD_LINT_FAILED} == 'true' ]]; then
echo -e "\n\n🪵 Logs from markdownlint:"
echo "${MD_LINT_LOG}"
Expand Down

0 comments on commit b98ad3c

Please sign in to comment.