Skip to content

Commit 3c86caf

Browse files
committed
fix: address code review feedback
Resolve review comments from @yolabingo: 1. Use JSON empty array [] instead of empty string for files output when no YAML files are changed. This ensures consistent JSON format for downstream processing. 2. For push events, use github.event.before and github.event.after instead of default branch comparison. This provides the correct commit range for push events as suggested.
1 parent 0692043 commit 3c86caf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

.github/workflows/deployment-guard.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,16 @@ jobs:
187187
BASE_SHA="${{ github.event.pull_request.base.sha }}"
188188
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
189189
else
190-
BASE_SHA="origin/${{ github.event.repository.default_branch }}"
191-
HEAD_SHA="HEAD"
190+
# For push events, use event.before and event.after for correct commit range
191+
BASE_SHA="${{ github.event.before }}"
192+
HEAD_SHA="${{ github.event.after }}"
192193
fi
193194
194195
CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -E '\.ya?ml$' || true)
195196
196197
if [ -z "$CHANGED_FILES" ]; then
197198
echo "No YAML files changed"
198-
echo "files=" >> "$GITHUB_OUTPUT"
199+
echo "files=[]" >> "$GITHUB_OUTPUT"
199200
else
200201
echo "Changed files:"
201202
echo "$CHANGED_FILES"

0 commit comments

Comments
 (0)