@@ -56,13 +56,34 @@ jobs:
5656 env :
5757 RELEASE_NOTES_FILE : ${{ secrets.RELEASE_NOTES_FILE }}
5858 run : |
59+ echo "File to check: $RELEASE_NOTES_FILE"
60+
61+ # Show git status for context
62+ echo "Current git status:"
63+ git status --porcelain
64+
65+ # Check if file has changes compared to origin/main
5966 if git diff --quiet origin/main -- "$RELEASE_NOTES_FILE"; then
67+ echo "No changes detected in release notes file"
68+ echo "File content is identical to origin/main"
6069 echo "files_are_same=true" >> $GITHUB_OUTPUT
6170 else
71+ echo "Changes detected in release notes file!"
72+ echo "Showing diff summary:"
73+ git diff --stat origin/main -- "$RELEASE_NOTES_FILE"
74+ echo ""
75+ echo "Detailed changes:"
76+ git diff origin/main -- "$RELEASE_NOTES_FILE" | head -50
6277 echo "files_are_same=false" >> $GITHUB_OUTPUT
6378 fi
64- # cat $RELEASE_NOTES_FILE
79+
80+ echo "Check completed. files_are_same=$(git diff --quiet origin/main -- "$RELEASE_NOTES_FILE" && echo 'true' || echo 'false')"
6581
82+ - name : Skip commit - No changes detected
83+ if : steps.check_changes.outputs.files_are_same == 'true'
84+ run : |
85+ echo "Skipping commit and PR creation - no changes detected"
86+
6687 - name : Commit and push release notes update
6788 if : steps.check_changes.outputs.files_are_same == 'false'
6889 uses : stefanzweifel/git-auto-commit-action@v5
@@ -86,12 +107,19 @@ jobs:
86107 # branch: ${{ steps.prepare_branch.outputs.branch }} # 你新建的分支名
87108 # draft: true # 以草稿状态创建,避免自动合并
88109
110+ - name : Skip PR creation - No changes detected
111+ if : steps.check_changes.outputs.files_are_same == 'true'
112+ run : |
113+ echo "Skipping PR creation - no changes detected"
114+
89115 - name : Create Pull Request via API
90116 if : steps.check_changes.outputs.files_are_same == 'false'
91117 env :
92118 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
93119 run : |
94- curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
120+ echo "Creating Pull Request for branch: ${{ steps.prepare_branch.outputs.branch }}"
121+
122+ PR_RESPONSE=$(curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
95123 -H "Accept: application/vnd.github+json" \
96124 https://api.github.com/repos/${{ github.repository }}/pulls \
97125 -d @- << EOF
@@ -102,3 +130,7 @@ jobs:
102130 "body": "This PR updates rel-notes.md automatically."
103131 }
104132 EOF
133+ )
134+
135+ echo "Pull Request Response:"
136+ echo "$PR_RESPONSE" | jq -r '"PR #" + (.number | tostring) + " created successfully: " + .html_url' 2>/dev/null || echo "$PR_RESPONSE"
0 commit comments