We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6a8a68a commit 8b13d02Copy full SHA for 8b13d02
.github/scripts/detect_changed_files.sh
@@ -5,7 +5,14 @@ set -e
5
# Script to check if files from specific pattern groups have changed in a PR
6
# Groups: backend, postgres, ui
7
8
-changed_files=$(git diff --name-only "origin/$GITHUB_BASE_REF...HEAD")
+if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
9
+ echo "Running on main branch, comparing with previous commit"
10
+ changed_files=$(git diff --name-only HEAD^ HEAD)
11
+else
12
+ echo "Running on non-default branch, comparing with $GITHUB_BASE_REF branch"
13
+ changed_files=$(git diff --name-only origin/$GITHUB_BASE_REF...HEAD)
14
+fi
15
+
16
17
if [ -z "$changed_files" ]; then
18
echo "No files changed in this PR compared to $GITHUB_BASE_REF branch."
0 commit comments