Skip to content

Update basics.md

Update basics.md #2528

name: Detect trailing whitespace
on: [push, pull_request]
jobs:
whitespace:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Remove whitespace and check the diff
run: |
set -eu
scripts/remove_trailing_whitespace.sh
git diff >whitespace.patch
cat whitespace.patch
if [ $(wc -c <whitespace.patch) -ne 0 ] ; then
echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "
echo "You have trailing whitespace, please download the artifact"
echo "and apply with git apply <whitespace.patch or"
echo "run scripts/remove_trailing_whitespace.sh locally."
echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "
exit 1
else
echo "no trailing whitespace found, good!"
fi
- name: Archive whitespace patch
uses: actions/upload-artifact@v2
if: always()
with:
name: whitespace-patch
path: |
whitespace.patch
if-no-files-found: ignore