Fix indentation test

This commit is contained in:
Matthias Kuhn 2020-05-11 07:17:56 +02:00
parent 91c79f46a7
commit d877d310b5
2 changed files with 9 additions and 11 deletions

View File

@ -95,12 +95,15 @@ jobs:
run: ./tests/code_layout/test_doxygen_layout.sh run: ./tests/code_layout/test_doxygen_layout.sh
indentation_check: indentation_check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Indentation Test - name: Indentation Test
run: ./scripts/verify_indentation.sh run: ./scripts/verify_indentation.sh ${{ github.event.pull_request.head.sha }}..${{ github.event.pull_request.base.sha }}
spell_check: spell_check:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -3,8 +3,9 @@ cd $(git rev-parse --show-toplevel)
export PATH=$PATH:$PWD/scripts export PATH=$PATH:$PWD/scripts
if [ -z "$TRAVIS_COMMIT_RANGE" ]; then if [ -z "$1" ]; then
echo "No commit range given" echo "No commit range given. "
echo " Usage: ./scripts/verify_indentation [HEAD_REF]..[BASE_REF]"
exit 0 exit 0
fi fi
@ -19,14 +20,8 @@ ASTYLEDIFF=/tmp/astyle.diff
true > $ASTYLEDIFF true > $ASTYLEDIFF
if [[ -n $TRAVIS_PULL_REQUEST_BRANCH ]]; then echo "Commit range: $1"
# if on a PR, just analyze the changed files FILES=$(git diff --diff-filter=AM --name-only $1 | tr '\n' ' ' )
echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH"
FILES=$(git diff --diff-filter=AM --name-only $(git merge-base HEAD ${TRAVIS_BRANCH}) | tr '\n' ' ' )
elif [[ -n $TRAVIS_COMMIT_RANGE ]]; then
echo "TRAVIS COMMIT RANGE: $TRAVIS_COMMIT_RANGE"
FILES=$(git diff --diff-filter=AM --name-only ${TRAVIS_COMMIT_RANGE/.../..} | tr '\n' ' ' )
fi
for f in $FILES; do for f in $FILES; do
if ! [ -f "$f" ]; then if ! [ -f "$f" ]; then