Merge pull request #355 from beeware/tweaks #119
This file contains 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 | |
on: | |
push: | |
branches: | |
main | |
# Cancel active CI runs for a PR before starting another run | |
concurrency: | |
group: translate-${{ github.ref }} | |
cancel-in-progress: true | |
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: | | |
**/pyproject.toml | |
.pre-commit-config.yaml | |
- name: Update pip | |
run: python -m pip install -U pip | |
- name: Install tox | |
run: python -m pip install .[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 | |
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 commit -m "Update translations to $(git rev-parse --short HEAD)." | |
git push origin |