Skip to content

Commit 89093a3

Browse files
authoredJan 16, 2025··
github: Run deps workflow against PR target branch and improve dir names (#8010)
1 parent 9dc22c0 commit 89093a3

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed
 

‎.github/workflows/deps.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,20 @@ jobs:
3030
# Run the commands to generate dependencies before and after and compare.
3131
- name: Compare dependencies
3232
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}"
3537
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"
3944
4045
echo "Comparing dependencies..."
46+
cd "${TEMP_DIR}"
4147
# 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 "@@"'
4349
echo "No changes detected."

0 commit comments

Comments
 (0)
Please sign in to comment.