File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -75,12 +75,20 @@ jobs:
75
75
steps :
76
76
- name : " Check out code"
77
77
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
78
-
78
+ with :
79
+ fetch-depth : 1 # Fetch the last commit and parent
80
+
79
81
- name : " Determine scope"
80
82
id : scope
81
83
run : |
82
84
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
+
84
92
selected_workspaces=""
85
93
for file in $changed_files; do
86
94
if [[ $file == packages/pluggableWidgets/* ]]; then
90
98
fi
91
99
fi
92
100
done
101
+
93
102
if [[ -n "$selected_workspaces" ]]; then
94
103
echo "scope=--all --include '$selected_workspaces'" >> $GITHUB_OUTPUT
95
104
echo "widgets=[\"$selected_workspaces\"]" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments