Skip to content

Make translation links conditional. (#135) #200

Make translation links conditional. (#135)

Make translation links conditional. (#135) #200

Workflow file for this run

name: Update Translations
on:
push:
branches:
main
defaults:
run:
shell: bash # https://github.com/beeware/briefcase/pull/912
env:
FORCE_COLOR: "1"
jobs:
update-translations:
name: Update Translations
if: github.actor != 'brutusthebee'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
token: ${{ secrets.BRUTUS_PAT_TOKEN }}
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.X"
cache: pip
cache-dependency-path: |
.pre-commit-config.yaml
- name: Update pip
run: python -m pip install -U pip
- name: Install tox
run: python -m pip install --group dev
- name: Configure git
run: |
git config --local user.email "$(git log --pretty='%ae' -1)"
git config --local user.name "brutusthebee[bot]"
- name: Regenerate PO files
env:
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }}
run: |
tox -e docs-translate
- name: Update Needed?
id: updated
run: |
if [[ $(git status --porcelain) ]]; then
echo "updated=true" >> ${GITHUB_OUTPUT}
else
echo "updated=false" >> ${GITHUB_OUTPUT}
fi
- name: Commit updated translations
if: steps.updated.outputs.updated == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
# Commit the updated PO files.
git add docs/locales
git add src/beeware_docs_tools/shared_content/locales
git commit -m "Update translations to $(git rev-parse --short HEAD)."
git push origin