Skip to content

Commit 05d9ff4

Browse files
authored
ci: Make raven tests work on release branches (#1596)
1 parent 72a8bce commit 05d9ff4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scripts/detect-raven.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/bin/bash
2-
set -e
2+
set -eu
33

44
echo ""
55
echo "RAVEN: $RAVEN"
66

7-
# Does any of the commits in a PR contain "[force ci]" string?
8-
COMMITS=$(git --no-pager log master.. --no-merges --format=%s)
7+
# Find the latest commit that is present in master and the branch we test
8+
MASTER_TMP=master-latest-tmp
9+
git fetch origin master:${MASTER_TMP}
10+
MERGE_BASE=$(git merge-base ${MASTER_TMP} ${TRAVIS_BRANCH:-master})
11+
12+
# Does any of the new commits contain "[force ci]" string?
13+
COMMITS=$(git --no-pager log ${MERGE_BASE}.. --no-merges --format=%s)
914
if [[ -n "$(grep '\[force ci\]' <<< "$COMMITS")" ]]; then
1015
HAS_FORCE_COMMIT=true
1116
else
@@ -16,7 +21,7 @@ fi
1621
echo "HAS_FORCE_COMMIT: $HAS_FORCE_COMMIT"
1722

1823
# Does any changed file lives in raven-js/raven-node directory?
19-
CHANGES=$(git --no-pager diff --name-only master)
24+
CHANGES=$(git --no-pager diff --name-only ${MERGE_BASE})
2025
if [[ -n "$(grep "$RAVEN" <<< "$CHANGES")" ]]; then
2126
HAS_CHANGES=true
2227
else

0 commit comments

Comments
 (0)