File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,20 @@ jobs:
30
30
# Run the commands to generate dependencies before and after and compare.
31
31
- name : Compare dependencies
32
32
run : |
33
- BEFORE="$(mktemp -d)"
34
- AFTER="$(mktemp -d)"
33
+ set -eu
34
+ TEMP_DIR="$(mktemp -d)"
35
+ # GITHUB_BASE_REF is set when the job is triggered by a PR.
36
+ TARGET_REF="${GITHUB_BASE_REF:-master}"
35
37
36
- scripts/gen-deps.sh "${AFTER}"
37
- git checkout origin/master
38
- scripts/gen-deps.sh "${BEFORE}"
38
+ mkdir "${TEMP_DIR}/after"
39
+ scripts/gen-deps.sh "${TEMP_DIR}/after"
40
+
41
+ git checkout "origin/${TARGET_REF}"
42
+ mkdir "${TEMP_DIR}/before"
43
+ scripts/gen-deps.sh "${TEMP_DIR}/before"
39
44
40
45
echo "Comparing dependencies..."
46
+ cd "${TEMP_DIR}"
41
47
# Run grep in a sub-shell since bash does not support ! in the middle of a pipe
42
- diff -u0 -r "${BEFORE} " "${AFTER} " | bash -c '! grep -v "@@"'
48
+ diff -u0 -r "before " "after " | bash -c '! grep -v "@@"'
43
49
echo "No changes detected."
You can’t perform that action at this time.
0 commit comments