Skip to content
Snippets Groups Projects
Commit 2489fe21 authored by Patrick Bos's avatar Patrick Bos Committed by Axel Naumann
Browse files

pass BASE_COMMIT to format_script.sh

It is not possible to use the base branch name in the GitHub Actions workflow to get the base SHA hash, because the branch name is not known there. To keep the format_script.sh universal, we just pass the SHA hash in from both the Travis and the GH Actions configurations instead.
parent a098b3d2
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@
set -ex
BASE_COMMIT=$(git rev-parse $TRAVIS_BRANCH)
echo "Running clang-format against branch $TRAVIS_BRANCH, with hash $BASE_COMMIT"
COMMIT_FILES=$(git diff --name-only $BASE_COMMIT | grep -i -v LinkDef)
RESULT_OUTPUT="$(git-clang-format --commit $BASE_COMMIT --diff --binary `which clang-format` $COMMIT_FILES)"
......
......@@ -12,7 +12,7 @@ jobs:
env:
TRAVIS_BRANCH: ${{ github.base_ref }}
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
# BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
steps:
- uses: actions/checkout@v2
- name: Fetch base_ref HEAD
......
......@@ -23,7 +23,11 @@ matrix:
include:
- env: TOOL=clang-format
script: &format_script
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then .ci/format_script.sh; fi
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
export BASE_COMMIT=$(git rev-parse $TRAVIS_BRANCH)
.ci/format_script.sh
fi
- env: TOOL=clang-tidy-analyzer
before_script: &copy_headers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment