Skip to content

Commit

Permalink
Fix indentation test
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 11, 2020
1 parent 91c79f4 commit d877d31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/code_layout.yml
Expand Up @@ -95,12 +95,15 @@ jobs:
run: ./tests/code_layout/test_doxygen_layout.sh

indentation_check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- 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:
runs-on: ubuntu-latest
Expand Down
15 changes: 5 additions & 10 deletions scripts/verify_indentation.sh
Expand Up @@ -3,8 +3,9 @@ cd $(git rev-parse --show-toplevel)

export PATH=$PATH:$PWD/scripts

if [ -z "$TRAVIS_COMMIT_RANGE" ]; then
echo "No commit range given"
if [ -z "$1" ]; then
echo "No commit range given. "
echo " Usage: ./scripts/verify_indentation [HEAD_REF]..[BASE_REF]"
exit 0
fi

Expand All @@ -19,14 +20,8 @@ ASTYLEDIFF=/tmp/astyle.diff
true > $ASTYLEDIFF


if [[ -n $TRAVIS_PULL_REQUEST_BRANCH ]]; then
# if on a PR, just analyze the changed files
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
echo "Commit range: $1"
FILES=$(git diff --diff-filter=AM --name-only $1 | tr '\n' ' ' )

for f in $FILES; do
if ! [ -f "$f" ]; then
Expand Down

0 comments on commit d877d31

Please sign in to comment.