|
|
@@ -11,7 +11,71 @@ on:
|
|
|
- manticore-*
|
|
|
|
|
|
jobs:
|
|
|
+ translate_docs:
|
|
|
+ runs-on: ubuntu-24.04
|
|
|
+ permissions:
|
|
|
+ contents: write
|
|
|
+ pull-requests: read
|
|
|
+ defaults:
|
|
|
+ run:
|
|
|
+ shell: bash
|
|
|
+ steps:
|
|
|
+ - name: Check origin repository
|
|
|
+ id: repo-check
|
|
|
+ run: |
|
|
|
+ if [ "${{ github.event_name }}" == "pull_request" ]; then
|
|
|
+ repo="${{ github.event.pull_request.head.repo.full_name }}"
|
|
|
+ else
|
|
|
+ repo="${{ github.repository }}"
|
|
|
+ fi
|
|
|
+ echo "repo=$repo" >> $GITHUB_OUTPUT
|
|
|
+
|
|
|
+ - name: Checkout
|
|
|
+ uses: actions/checkout@v3
|
|
|
+ with:
|
|
|
+ fetch-depth: 0
|
|
|
+ repository: ${{ steps.repo-check.outputs.repo }}
|
|
|
+ token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
+ submodules: true
|
|
|
+ ref: ${{ github.head_ref }}
|
|
|
+
|
|
|
+ - name: Setup PHP
|
|
|
+ uses: shivammathur/setup-php@v2
|
|
|
+ with:
|
|
|
+ php-version: '8.2'
|
|
|
+ tools: composer
|
|
|
+ extensions: curl
|
|
|
+
|
|
|
+ - name: Run auto-translate
|
|
|
+ env:
|
|
|
+ OPENROUTER_TRANSLATOR_API_KEY: ${{ secrets.OPENROUTER_TRANSLATOR_API_KEY }}
|
|
|
+ run: |
|
|
|
+ set -e
|
|
|
+ # Install PHP dependencies for translator
|
|
|
+ cd translator
|
|
|
+ composer install --no-dev --no-interaction --prefer-dist
|
|
|
+ cd ..
|
|
|
+
|
|
|
+ # Configure git for commits
|
|
|
+ git config --global user.name "github-actions[bot]"
|
|
|
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
+
|
|
|
+ # Run auto-translate
|
|
|
+ ./translator/bin/auto-translate
|
|
|
+
|
|
|
+ # Check if there are any changes to commit
|
|
|
+ if ! git diff --quiet; then
|
|
|
+ echo "Auto-translate made changes, committing them..."
|
|
|
+ git add .
|
|
|
+ git commit -m "docs: Auto-translate documentation changes by ${{ github.actor }}"
|
|
|
+ git push
|
|
|
+ echo "Changes committed and pushed successfully"
|
|
|
+ else
|
|
|
+ echo "No changes made by auto-translate"
|
|
|
+ fi
|
|
|
+
|
|
|
docs_check:
|
|
|
+ needs: translate_docs
|
|
|
runs-on: ubuntu-22.04
|
|
|
permissions:
|
|
|
contents: write
|
|
|
@@ -73,42 +137,6 @@ jobs:
|
|
|
done
|
|
|
echo "$filepathes"
|
|
|
echo "filepathes=$filepathes" >> $GITHUB_OUTPUT
|
|
|
- - name: Run auto-translate
|
|
|
- run: |
|
|
|
- set -e
|
|
|
- add-apt-repository ppa:rmescandon/yq
|
|
|
- apt-get update -y
|
|
|
- apt-get install -y yq gettext-base
|
|
|
- curl -sSL https://github.com/sigoden/aichat/releases/download/v0.30.0/aichat-v0.30.0-x86_64-unknown-linux-musl.tar.gz > /tmp/aichat.tar.gz
|
|
|
- tar -xzf /tmp/aichat.tar.gz -C /usr/bin/
|
|
|
-
|
|
|
- # Configure the aichat
|
|
|
- mkdir -p ~/.config/aichat
|
|
|
- echo "clients:" > ~/.config/aichat/config.yaml
|
|
|
- echo "- type: openai" >> ~/.config/aichat/config.yaml
|
|
|
- echo " api_key: ${{ secrets.TRANSLATOR_OPENAI_KEY }}" >> ~/.config/aichat/config.yaml
|
|
|
- echo "- type: claude" >> ~/.config/aichat/config.yaml
|
|
|
- echo " api_key: ${{ secrets.TRANSLATOR_ANTHROPIC_KEY }}" >> ~/.config/aichat/config.yaml
|
|
|
-
|
|
|
- cat ~/.config/aichat/config.yaml
|
|
|
-
|
|
|
- # Configure git for commits
|
|
|
- git config --global user.name "github-actions[bot]"
|
|
|
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
-
|
|
|
- # Run auto-translate
|
|
|
- ./translator/bin/auto-translate
|
|
|
-
|
|
|
- # Check if there are any changes to commit
|
|
|
- if ! git diff --quiet; then
|
|
|
- echo "Auto-translate made changes, committing them..."
|
|
|
- git add .
|
|
|
- git commit -m "docs: Auto-translate documentation changes by ${{ github.actor }}"
|
|
|
- git push
|
|
|
- echo "Changes committed and pushed successfully"
|
|
|
- else
|
|
|
- echo "No changes made by auto-translate"
|
|
|
- fi
|
|
|
- name: Check docs
|
|
|
id: check
|
|
|
run: |
|