This repository has been archived by the owner on Aug 9, 2024. It is now read-only.
ci: fix localize workflow (#41) #2
Workflow file for this run
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: [nightly] | |
paths: # prevents workflow from running unless these files change | |
- '.github/workflows/localize.yml' | |
- 'Contents/Strings/plugger.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@v3 | |
- name: Install Python | |
uses: LizardByte/action-setup-python@master | |
with: | |
python-version: '2.7' | |
- name: Set up Python Dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
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 Contents/Strings/plugger.po | |
# set the variable with minimal output, replacing `\t` with ` ` | |
OUTPUT=$(git diff --numstat Contents/Strings/plugger.po | sed -e "s#\t# #g") | |
echo "git_diff=${OUTPUT}" >> $GITHUB_ENV | |
- name: git reset | |
if: ${{ env.git_diff == '1 1 Contents/Strings/plugger.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@v4 | |
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: nightly | |
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 |