Merge pull request #1164 from mihneabulu/fix/global-csrf-token-for-ca… #243
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Translations and Wiki Status | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'cps/**' | |
| - 'scripts/compile_translations.sh' | |
| - 'scripts/update_translations.sh' | |
| - 'scripts/generate_translation_status.py' | |
| - '.github/workflows/update-translations.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| actions: write | |
| jobs: | |
| update-translations: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install dependencies | |
| run: pip install Babel polib jinja2 | |
| - name: Install gettext | |
| run: sudo apt-get update && sudo apt-get install -y gettext | |
| - name: Run update_translations.sh | |
| run: bash scripts/update_translations.sh | |
| - name: Commit translation updates | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -f messages.pot cps/translations/*/LC_MESSAGES/messages.po | |
| if git diff --cached --quiet; then | |
| echo "No translation changes to commit" | |
| echo "TRANSLATION_COMMITTED=0" >> $GITHUB_ENV | |
| else | |
| git commit -m "Update translations [skip ci]" | |
| git push | |
| echo "TRANSLATION_COMMITTED=1" >> $GITHUB_ENV | |
| echo "TRANSLATION_COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
| fi | |
| - name: Select dev build SHA | |
| run: | | |
| if [ "${{ env.TRANSLATION_COMMITTED }}" = "1" ]; then | |
| echo "DEV_BUILD_SHA=${{ env.TRANSLATION_COMMIT_SHA }}" >> $GITHUB_ENV | |
| else | |
| echo "DEV_BUILD_SHA=${{ github.sha }}" >> $GITHUB_ENV | |
| fi | |
| - name: Trigger dev build for main | |
| run: | | |
| curl -L -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| https://api.github.com/repos/${{ github.repository }}/actions/workflows/docker-image-build-dev.yml/dispatches \ | |
| -d "{\"ref\":\"main\",\"inputs\":{\"ref\":\"${DEV_BUILD_SHA}\",\"branch\":\"main\"}}" | |
| - name: Clone wiki repo | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
| run: | | |
| git clone https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.wiki.git wiki-tmp | |
| - name: Generate translation status table (in wiki repo) | |
| run: | | |
| python scripts/generate_translation_status.py wiki-tmp/Contributing-Translations.md | |
| - name: Commit and push wiki update | |
| run: | | |
| cd wiki-tmp | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add Contributing-Translations.md | |
| git commit -m "Update translation status table [skip ci]" || echo "No changes to commit" | |
| git push |