Skip to content

Commit 1a7ebb1

Browse files
committed
fx
1 parent 7f3061a commit 1a7ebb1

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎.github/workflows/sync-openapi.yml‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,23 @@ jobs:
7474
- name: Check for changes
7575
id: changes
7676
run: |
77-
if [ ! -f openapi.json ]; then
78-
echo "has_changes=true" >> $GITHUB_OUTPUT
79-
echo "New openapi.json file will be created"
80-
elif git diff --quiet openapi.json 2>/dev/null; then
77+
# Check if file is new (untracked) or modified
78+
if ! git ls-files --error-unmatch openapi.json 2>/dev/null; then
79+
# File is not tracked by git - it's new
80+
if [ -f openapi.json ]; then
81+
echo "has_changes=true" >> $GITHUB_OUTPUT
82+
echo "New openapi.json file will be created"
83+
else
84+
echo "has_changes=false" >> $GITHUB_OUTPUT
85+
echo "Error: openapi.json was not generated"
86+
fi
87+
elif git diff --quiet openapi.json; then
8188
echo "has_changes=false" >> $GITHUB_OUTPUT
8289
echo "No changes detected in OpenAPI spec"
8390
else
8491
echo "has_changes=true" >> $GITHUB_OUTPUT
8592
echo "Changes detected in OpenAPI spec"
86-
git diff --stat openapi.json 2>/dev/null || echo "New file"
93+
git diff --stat openapi.json
8794
fi
8895
8996
- name: Create Pull Request

0 commit comments

Comments
 (0)