Use base revision provided by CircleCI (#2309)

instead of GitHub API

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
This commit is contained in:
ylemkimon
2020-08-03 04:25:17 +09:00
committed by GitHub
parent 6b0d0d4d25
commit 891aae039e

View File

@@ -19,21 +19,6 @@ commands:
command: |
git submodule sync
git submodule update --init --recursive
- run:
name: Get changed files
command: |
if [[ $CIRCLE_PULL_REQUEST ]]; then
BASE_COMMIT=$(curl -s -H "Authorization: token a61ecb2fc5b72da54431""1b3db3875c96854958a8" \
https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER \
| jq -r ".base.sha | select(. != null)")...
else
BASE_COMMIT=HEAD^
fi
if [[ $BASE_COMMIT ]]; then
CHANGED=$(git diff --name-only $BASE_COMMIT)
echo "$CHANGED"
echo "export CHANGED=\"$CHANGED\"" >> $BASH_ENV
fi
skip_if_only_changed:
parameters:
@@ -42,7 +27,7 @@ commands:
steps:
- run:
name: Skip tests if only "<< parameters.filter >>" are changed
command: echo "$CHANGED" | grep -qvE '<< parameters.filter >>' || circleci step halt
command: git diff --name-only << pipeline.git.base_revision >>... | grep -qvE '<< parameters.filter >>' || circleci step halt
install_dependencies:
steps: