Skip to content

Commit d72f74e

Browse files
committed
Fetch all commit history in scope job
1 parent 4beb512 commit d72f74e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/NativePipeline.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,20 @@ jobs:
7575
steps:
7676
- name: "Check out code"
7777
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
78-
78+
with:
79+
fetch-depth: 1 # Fetch the last commit and parent
80+
7981
- name: "Determine scope"
8082
id: scope
8183
run: |
8284
if [ "${{ github.event_name }}" == "pull_request" ]; then
83-
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
85+
if git cat-file -e ${{ github.event.before }} 2>/dev/null; then
86+
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
87+
else
88+
echo "Previous commit not found, using HEAD~1 as fallback"
89+
changed_files=$(git diff --name-only HEAD~1 ${{ github.sha }})
90+
fi
91+
8492
selected_workspaces=""
8593
for file in $changed_files; do
8694
if [[ $file == packages/pluggableWidgets/* ]]; then
@@ -90,6 +98,7 @@ jobs:
9098
fi
9199
fi
92100
done
101+
93102
if [[ -n "$selected_workspaces" ]]; then
94103
echo "scope=--all --include '$selected_workspaces'" >> $GITHUB_OUTPUT
95104
echo "widgets=[\"$selected_workspaces\"]" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)