This repository has been archived by the owner on Oct 13, 2024. It is now read-only.
build(deps): bump LizardByte/setup-python-action (#350) #54
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' | |
- 'Contents/Strings/Themerr-plex.po' | |
- 'Contents/Code/**.py' | |
- 'Contents/Resources/web/templates/**' | |
workflow_dispatch: | |
jobs: | |
localize: | |
name: Update Localization | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: LizardByte/[email protected] | |
with: | |
python-version: '2.7' | |
- name: Set up Python Dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools requests | |
python -m pip install -r requirements.txt # requests is required to install python-plexapi | |
- 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 Contents/Strings/themerr-plex.po | |
# set the variable with minimal output, replacing `\t` with ` ` | |
OUTPUT=$(git diff --numstat Contents/Strings/themerr-plex.po | sed -e "s#\t# #g") | |
echo "git_diff=${OUTPUT}" >> $GITHUB_ENV | |
- name: git reset | |
if: ${{ env.git_diff == '1 1 Contents/Strings/themerr-plex.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@v5 | |
with: | |
add-paths: | | |
Contents/Strings/*.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 |