Skip to content

Commit

Permalink
[test] fix empty CIRCLE_COMPARE_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Aug 18, 2018
1 parent e667a85 commit 9b25d39
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ jobs:
- checkout
- *restore_repo
- run:
name: Check if yarn prettier was run
name: Export COMMIT_RANGE
command: |
# commit range between master and branch
# CIRCLE_COMPARE_URL=https://github.com/org/repo/compare/sha1...sha1
COMMIT_RANGE=$(grep -oP "\w+\.\.\.\w+" <<< "$CIRCLE_COMPARE_URL")
# https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-shell-command
echo 'export COMMIT_RANGE=$(grep -oP "\w+\.\.\.\w+" <<< "$CIRCLE_COMPARE_URL")' >> $BASH_ENV
source $BASH_ENV
- run:
name: Check if yarn prettier was run
command: |
# Files changed on this branch
CHANGED_FILES=$(git diff --name-only "$COMMIT_RANGE")
# if we use an empty string as a pattern grep will match everything
Expand Down

0 comments on commit 9b25d39

Please sign in to comment.