feat: just one

This commit is contained in:
Alter-xyz
2025-05-17 23:51:16 +08:00
parent f7084d1060
commit fb3ade9d72
4 changed files with 7 additions and 143 deletions

View File

@@ -1,13 +1,16 @@
name: Process Plugin Documentation
name: Process Documentation
on:
push:
branches: [test-action]
paths:
- 'plugin_dev_zh/**'
- 'tools/**'
- 'plugin_dev_en/**'
- 'plugin_dev_ja/**'
- 'tools/**'
- 'plugin_dev_zh/**'
- 'en/**'
- 'ja-jp/**'
- 'zh_hans/**'
workflow_dispatch:
jobs:
@@ -32,7 +35,7 @@ jobs:
- name: Run documentation tools
id: doc-tools
run: python tools/main_docs_plugin_dev.py
run: python tools/main_docs_bundle.py
- name: Display results
run: |

View File

@@ -1,65 +0,0 @@
name: Process General Documentation
on:
push:
branches: [test-action]
paths-ignore:
- 'plugin_dev_zh/**'
- 'plugin_dev_en/**'
- 'plugin_dev_ja/**'
- 'tools/**'
- '.github/**' # 避免工作流文件变更触发自身
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_lite.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
# Use commit message from script output, or default if not available
COMMIT_MESSAGE="${{ steps.doc-tools.outputs.commit_message || 'Documentation tools automatic execution' }}"
git config --local user.email "88554920+alterxyz@users.noreply.github.com"
git config --local user.name "alterxyz"
git add .
git commit -m "$COMMIT_MESSAGE" || echo "No changes to commit"
git push
echo "Changes committed: $COMMIT_MESSAGE"
else
echo "No file changes, skipping commit"
fi

View File

@@ -1,74 +0,0 @@
import os
import sys
# from rename_by_dimensions import main_rename_by_dimensions
from contributing_in_page import main_contributing_in_page
# from apply_docs_json import main_apply_docs_json
def set_github_output(name, value):
github_output = os.environ.get('GITHUB_OUTPUT')
if github_output:
with open(github_output, 'a') as f:
if '\n' in str(value):
f.write(f"{name}<<EOF\n")
f.write(f"{value}\n")
f.write("EOF\n")
else:
f.write(f"{name}={value}\n")
else:
print(f"[GitHub Output] {name}={value}")
def main():
total_message = ""
success_count = 0
error_count = 0
# try:
# result_rename = main_rename_by_dimensions()
# if result_rename == "success":
# success_count += 1
# else:
# error_count += 1
# total_message += f"Rename operation failed: {result_rename}\n"
# except Exception as e:
# error_count += 1
# total_message += f"Rename operation error: {str(e)}\n"
try:
result_contributing = main_contributing_in_page()
if result_contributing == "success":
success_count += 1
else:
error_count += 1
total_message += f"Contributing guide processing failed: {result_contributing}\n"
except Exception as e:
error_count += 1
total_message += f"Contributing guide processing error: {str(e)}\n"
# try:
# result_apply = main_apply_docs_json()
# if result_apply == "success":
# success_count += 1
# else:
# error_count += 1
# total_message += f"Docs JSON application failed: {result_apply}\n"
# except Exception as e:
# error_count += 1
# total_message += f"Docs JSON application error: {str(e)}\n"
if error_count == 0:
commit_message = "Docs tools: Successfully processed contributing guide"
print("Contributing guide processing executed successfully.")
else:
commit_message = "Docs tools: Contributing guide processing failed"
print("Contributing guide processing encountered issues:")
print(total_message)
set_github_output("commit_message", commit_message)
set_github_output("detailed_message", total_message)
set_github_output("success_count", str(success_count))
set_github_output("error_count", str(error_count))
if __name__ == "__main__":
main()