Skip to content

Commit ad96cd9

Browse files
committed
Add tab detection to CI tests.
1 parent d0b5488 commit ad96cd9

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/tab-finder.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Find tabs in modified text files
2+
name: Tab finder
3+
on: [push, pull_request]
4+
env:
5+
MAIN_BRANCH: dev
6+
jobs:
7+
build:
8+
name: Tab finder
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Code
12+
uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0 # needed to get the full history and pull from upstream
15+
- name: Pull from upstream
16+
run: |
17+
# Update from upstream to avoid including missing commits in the diff
18+
git config --global user.name "Nemo" # required on some servers
19+
git config pull.rebase false
20+
git remote add upstream https://github.com/AliceO2Group/AliceO2.git || exit 1
21+
git pull upstream ${{ env.MAIN_BRANCH }} || exit 1
22+
- name: Find tabs
23+
run: |
24+
# Find tabs in modified text files and show where they are
25+
status=0
26+
# loop over changed files
27+
for f in $(git diff --name-only upstream/${{ env.MAIN_BRANCH }}); do
28+
# ignore binary files
29+
file -bi "$f" | grep -q "charset=binary" && continue
30+
# find tabs in file
31+
echo "Scanning file: $f"
32+
if grep -q -P "\t" "$f"; then
33+
status=1
34+
echo "Found some tabs:"
35+
# print out where the tabs are
36+
grep -P -n -C 1 "\t" "$f"
37+
fi
38+
done
39+
exit $status

0 commit comments

Comments
 (0)