fix: git message

This commit is contained in:
Alter-xyz
2025-05-18 00:20:13 +08:00
parent 23570e4d9a
commit 2ca78ac8e9
3 changed files with 17 additions and 33 deletions

View File

@@ -52,22 +52,29 @@ jobs:
run: |
# Check if there are file changes
if [[ -n "$(git status --porcelain)" ]]; then
FIXED_COMMIT_SUBJECT="Docs: Automated documentation updates"
COMMIT_DESCRIPTION=""
FINAL_COMMIT_SUBJECT=""
if [[ -n "${{ steps.doc-tools.outputs.commit_message }}" ]]; then
COMMIT_DESCRIPTION="${{ steps.doc-tools.outputs.commit_message }}"
FINAL_COMMIT_SUBJECT="${{ steps.doc-tools.outputs.commit_message }}"
else
COMMIT_DESCRIPTION="Automated processing of documentation files."
FINAL_COMMIT_SUBJECT="Docs: Automated documentation updates" # Default subject if script provides none
fi
FINAL_COMMIT_BODY=""
if [[ -n "${{ steps.doc-tools.outputs.detailed_message }}" ]]; then
FINAL_COMMIT_BODY="${{ steps.doc-tools.outputs.detailed_message }}"
else
FINAL_COMMIT_BODY="No detailed information provided by the script." # Default body if script provides none
fi
git config --local user.email "88554920+alterxyz@users.noreply.github.com"
git config --local user.name "alterxyz"
git add .
git commit -m "$FIXED_COMMIT_SUBJECT" -m "$COMMIT_DESCRIPTION" || echo "No changes to commit"
# Use the subject from script's commit_message and body from script's detailed_message
git commit -m "$FINAL_COMMIT_SUBJECT" -m "$FINAL_COMMIT_BODY" || echo "No changes to commit"
git push
echo "Changes committed with subject: $FIXED_COMMIT_SUBJECT"
echo "Description: $COMMIT_DESCRIPTION"
echo "Changes committed with subject: $FINAL_COMMIT_SUBJECT"
echo "Description:"
echo "$FINAL_COMMIT_BODY"
else
echo "No file changes, skipping commit"
fi