Files
dify-docs/.github/workflows/docs_bundle.yml
2025-05-19 10:37:03 +08:00

81 lines
3.1 KiB
YAML

name: Process Documentation
on:
push:
branches: [main]
paths:
- 'tools/**'
- 'plugin-dev-en/**'
- 'plugin-dev-ja/**'
- 'plugin-dev-zh/**'
- 'en/**'
- 'ja-jp/**'
- 'zh_hans/**'
workflow_dispatch:
jobs:
process-docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Run documentation tools
id: doc-tools
run: python tools/main_docs_bundle.py
- name: Display results
run: |
echo "Execution results:"
echo "Successful operations: ${{ steps.doc-tools.outputs.success_count }}"
echo "Failed operations: ${{ steps.doc-tools.outputs.error_count }}"
if [ "${{ steps.doc-tools.outputs.detailed_message }}" != "" ]; then
echo "Details:"
echo "${{ steps.doc-tools.outputs.detailed_message }}"
fi
- name: Commit changes
if: always() # Execute this step even if previous steps fail
run: |
# Check if there are file changes
if [[ -n "$(git status --porcelain)" ]]; then
FINAL_COMMIT_SUBJECT=""
if [[ -n "${{ steps.doc-tools.outputs.commit_message }}" ]]; then
FINAL_COMMIT_SUBJECT="${{ steps.doc-tools.outputs.commit_message }}"
else
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 .
# 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: $FINAL_COMMIT_SUBJECT"
echo "Description:"
echo "$FINAL_COMMIT_BODY"
else
echo "No file changes, skipping commit"
fi