This repository has been archived by the owner on Oct 13, 2024. It is now read-only.
chore(l10n): new babel updates (#604) #48
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: localize | |
on: | |
push: | |
branches: [master] | |
paths: # prevents workflow from running unless these files change | |
- '.github/workflows/localize.yml' | |
- 'retroarcher.py' | |
- 'locale/retroarcher.po' | |
- 'pyra/**.py' | |
- 'web/templates/**' | |
workflow_dispatch: | |
jobs: | |
localize: | |
name: Update Localization | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Python 3.9 | |
uses: actions/setup-python@v5 # https://github.com/actions/setup-python | |
with: | |
python-version: '3.9' | |
- name: Set up Python 3.9 Dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
python -m pip install -r requirements.txt | |
- name: Update Strings | |
run: | | |
python ./scripts/_locale.py --extract | |
- name: git diff | |
run: | | |
# disable the pager | |
git config --global pager.diff false | |
# print the git diff | |
git diff locale/retroarcher.po | |
# set the variable with minimal output, replacing `\t` with ` ` | |
OUTPUT=$(git diff --numstat locale/retroarcher.po | sed -e "s#\t# #g") | |
echo "git_diff=${OUTPUT}" >> $GITHUB_ENV | |
- name: git reset | |
if: ${{ env.git_diff == '1 1 locale/retroarcher.po' }} # only run if more than 1 line changed | |
run: | | |
git reset --hard | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Create/Update Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
add-paths: | | |
locale/*.po | |
token: ${{ secrets.GH_BOT_TOKEN }} # must trigger PR tests | |
commit-message: New localization template | |
branch: localize/update | |
delete-branch: true | |
base: master | |
title: New Babel Updates | |
body: | | |
Update report | |
- Updated ${{ steps.date.outputs.date }} | |
- Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
labels: | | |
babel | |
l10n |