Revamp github actions validation workflow #12
Workflow file for this run
This file contains hidden or 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
name: Check for Windows line endings | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
check-line-endings: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# since this workflow doesn't rely on git-annex, there's no need to take | |
# into account potential forks of the repo; we can just use github's | |
# auto-generated merge commit that lives in this repo | |
- name: Install dos2unix | |
run: | | |
# the easy way to do this: convert everything to unix and ask git if that changed anything | |
sudo apt-get install -y dos2unix | |
- name: Check line endings | |
run: | | |
# the easy way to do this: convert everything to unix and ask git if that changed anything | |
find ./ -path ./.git -prune -o -type f -print0 | xargs -0 dos2unix -q | |
# this version is safer, but more maintenance: | |
#find ./ -path ./.git -prune -o -type f \( ! -name "*.nii" -a ! -name "*.nii.gz" \) -print0 | xargs -0 dos2unix -q | |
git diff --stat --exit-code | |
if [ "$?" -ne 0 ]; then | |
echo "error: Windows line endings found." | |
exit 1 | |
fi |