forked from getsentry/sentry-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetect-raven.sh
More file actions
executable file
·41 lines (32 loc) · 1 KB
/
detect-raven.sh
File metadata and controls
executable file
·41 lines (32 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -eu
echo ""
echo "RAVEN: $RAVEN"
# Find the latest commit that is present in master and the branch we test
MASTER_TMP=master-latest-tmp
git fetch origin master:${MASTER_TMP}
MERGE_BASE=$(git merge-base ${MASTER_TMP} ${TRAVIS_BRANCH:-master})
# Does any of the new commits contain "[force ci]" string?
COMMITS=$(git --no-pager log ${MERGE_BASE}.. --no-merges --format=%s)
if [[ -n "$(grep '\[force ci\]' <<< "$COMMITS")" ]]; then
HAS_FORCE_COMMIT=true
else
HAS_FORCE_COMMIT=false
fi
# echo "COMMITS: $COMMITS"
echo "HAS_FORCE_COMMIT: $HAS_FORCE_COMMIT"
# Does any changed file lives in raven-js/raven-node directory?
CHANGES=$(git --no-pager diff --name-only ${MERGE_BASE})
if [[ -n "$(grep "$RAVEN" <<< "$CHANGES")" ]]; then
HAS_CHANGES=true
else
HAS_CHANGES=false
fi
echo "HAS_CHANGES: $HAS_CHANGES"
# If any of the above is true, run tests
if [[ ( $HAS_FORCE_COMMIT == "true" || $HAS_CHANGES == "true" ) ]]; then
SHOULD_RUN=true
else
SHOULD_RUN=false
fi
echo "SHOULD_RUN: $SHOULD_RUN"