Skip to content

Commit 57438a1

Browse files
committed
ci: add empty compare object
Signed-off-by: markkovari <kovarimarkofficial@gmail.com>
1 parent 30f8465 commit 57438a1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ jobs:
2828
if [ "${{ github.event_name }}" == "pull_request" ]; then
2929
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
3030
else
31-
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
31+
# Handle first push or null before hash
32+
BEFORE="${{ github.event.before }}"
33+
if [ "$BEFORE" == "0000000000000000000000000000000000000000" ] || [ -z "$BEFORE" ]; then
34+
# Get files changed in the last commit
35+
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD 2>/dev/null || git ls-files)
36+
else
37+
CHANGED_FILES=$(git diff --name-only $BEFORE ${{ github.sha }})
38+
fi
3239
fi
3340
3441
echo "Changed files:"

0 commit comments

Comments
 (0)