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 5e5968c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ jobs:
steps:
- checkout
- *restore_repo
- run:
name: Setup Environment Variables
command: |
# https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-shell-command
echo 'export COMPARE_URL="$CIRCLE_COMPARE_URL"' >> $BASH_ENV
- run:
name: Check if yarn prettier was run
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")
COMMIT_RANGE=$(grep -oP "\w+\.\.\.\w+" <<< "$COMPARE_URL")
# 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 5e5968c

Please sign in to comment.