| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- name: 📖 Check docs
- run-name: 📖 Check docs ${{ github.sha }}
- on:
- workflow_call:
- workflow_run:
- workflows:
- - 📖 Trigger doc check
- types:
- - completed
- jobs:
- translate_docs:
- runs-on: ubuntu-24.04
- outputs:
- repo: ${{ steps.repo-check.outputs.repo }}
- ref: ${{ steps.repo-check.outputs.ref }}
- permissions:
- contents: write
- pull-requests: read
- defaults:
- run:
- shell: bash
- steps:
- - name: Download an artifact with PR repo name
- if: github.event_name == 'workflow_run'
- uses: actions/download-artifact@v4
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- run-id: ${{ github.event.workflow_run.id }}
- name: pr_repo
- path: .
- - name: Check origin repository
- id: repo-check
- run: |
- if [ "${{ github.event_name }}" == "workflow_run" ]; then
- PR_REPO=$(cat ./pr_repo.txt)
- repo=$(head -n 1 <<< "$PR_REPO")
- ref=$(tail -n 1 <<< "$PR_REPO")
- else
- repo="${{ github.repository }}"
- ref="${{ github.head_ref }}"
- fi
- echo "repo=$repo" >> $GITHUB_OUTPUT
- echo "ref=$ref" >> $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: ${{ steps.repo-check.outputs.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 (including untracked files)
- if [ -n "$(git status --porcelain)" ]; then
- echo "Auto-translate made changes, committing them..."
- git add -A
- 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
- pull-requests: read
- defaults:
- run:
- shell: bash
- container:
- image: manticoresearch/docs_autodeploy_multi:latest
- env:
- CACHEB: "../cache"
- DOCKER_HOST: tcp://docker:2375/
- DOCKER_DRIVER: overlay2
- COMMIT_DIR: manual
- DOCS_ERRORS_DIR: build/docs/
- GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
- steps:
- - name: Check origin repository
- id: repo-check
- run: |
- if [ "${{ github.event_name }}" == "workflow_run" ]; then
- repo="${{ needs.translate_docs.outputs.repo }}"
- ref="${{ needs.translate_docs.outputs.ref }}"
- elif [ "${{ github.event_name }}" == "pull_request" ]; then
- repo="${{ github.event.pull_request.head.repo.full_name }}"
- ref="${{ github.head_ref }}"
- else
- repo="${{ github.repository }}"
- ref="${{ github.head_ref || github.ref_name }}"
- fi
- echo "repo=$repo" >> $GITHUB_OUTPUT
- echo "ref=$ref" >> $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: ${{ steps.repo-check.outputs.ref }}
- - name: Fetch master and get changed files
- id: changed-files
- run: |
- git config --global --add safe.directory /__w/manticoresearch/manticoresearch
- # Update local master only if we're not currently on it
- if [ "${{ github.ref_name }}" != "master" -a "${{ github.event_name }}" != "pull_request" ]; then
- git fetch origin master:master
- fi
- git diff-tree --no-commit-id --name-only -r HEAD^1 HEAD | xargs
- echo "changed_files=$(git diff-tree --no-commit-id --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
- - name: Get changed doc filepathes
- id: doc-filepathes
- run: |
- filepathes=""
- for file in ${{ steps.changed-files.outputs.changed_files }}; do
- case "$file" in
- "$COMMIT_DIR/"*)
- filepathes="$file $filepathes"
- ;;
- esac
- done
- echo "$filepathes"
- echo "filepathes=$filepathes" >> $GITHUB_OUTPUT
- - name: Check docs
- id: check
- run: |
- docs_errors=$(php "/Deploy/check_docs_validity.php" "${{ steps.doc-filepathes.outputs.filepathes }}" "$COMMIT_DIR/" "$DOCS_ERRORS_DIR" | xargs)
- echo $docs_errors
- echo "errors=$docs_errors" >> $GITHUB_OUTPUT
- - name: Check docs translations
- run: |
- set -e
- ./misc/compare_manuals.sh
- - name: Upload artifact
- uses: manticoresoftware/upload_artifact_with_retries@v4
- with:
- name: Docs error artifact
- path: $DOCS_ERRORS_DIR
- - name: Display result
- run: |
- if [ "${{ steps.check.outputs.errors }}" != "" ]; then
- exit 1
- fi
- echo "Doc check passed successfully "
-
|