mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
feat: action
This commit is contained in:
65
.github/workflows/docs_contribute_button.yml
vendored
Normal file
65
.github/workflows/docs_contribute_button.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
name: Process General Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [test-action]
|
||||
paths:
|
||||
- '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
|
||||
63
.github/workflows/docs_plugin_dev_bundle.yml
vendored
Normal file
63
.github/workflows/docs_plugin_dev_bundle.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
name: Process Plugin Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [test-action]
|
||||
paths:
|
||||
- 'plugin_dev_zh/**'
|
||||
- 'plugin_dev_en/**'
|
||||
- 'plugin_dev_ja/**'
|
||||
- 'tools/**'
|
||||
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_plugin_dev.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
|
||||
40
.github/workflows/process-mdx.yml
vendored
40
.github/workflows/process-mdx.yml
vendored
@@ -1,40 +0,0 @@
|
||||
name: Process MDX Files
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ test-action ] # 仅在test-action分支上触发
|
||||
paths:
|
||||
- '**.mdx' # 只在MDX文件变更时触发
|
||||
- 'tools/**' # 或工具脚本变更时触发
|
||||
workflow_dispatch: # 允许手动触发
|
||||
|
||||
jobs:
|
||||
process-mdx:
|
||||
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 MDX processing script
|
||||
run: python tools/1_rename_by_dimensions.py
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config --local user.email "88554920+alterxyz@users.noreply.github.com"
|
||||
git config --local user.name "alterxyz"
|
||||
git add .
|
||||
git commit -m "Auto-process MDX files [skip ci]" || echo "No changes to commit"
|
||||
git push
|
||||
Reference in New Issue
Block a user