Fix file check in CResource (Fixes #3201, PR #3202) #1110
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: "Rebuild en_US pot files" | |
on: [push, workflow_dispatch] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: mtasa | |
environment-file: utils/localization/environment.yml | |
python-version: 3 | |
auto-activate-base: false | |
- name: Install gettext | |
run: | | |
sudo apt-get update | |
sudo apt-get install --yes --no-install-recommends gettext | |
- name: Run tests | |
run: pytest "utils/localization/tests" | |
shell: bash -l {0} | |
rebuild-pots: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.POT_CI_PAT }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: mtasa | |
environment-file: utils/localization/environment.yml | |
python-version: 3 | |
auto-activate-base: false | |
- name: Install gettext | |
run: | | |
sudo apt-get update | |
sudo apt-get install --yes --no-install-recommends gettext | |
- run: python "utils/localization/build_gettext_catalog.py" | |
shell: bash -l {0} | |
- run: python "utils/localization/build_gettext_catalog_nsi.py" | |
shell: bash -l {0} | |
- id: stage_changes | |
name: Commit changes | |
run: | | |
# GitHub Actions bot user | |
git config --global user.name "Pot Bot" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
# Check that diff contains something and it's not only POT-Creation-Date | |
if [[ $(git diff --unified=0 "Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot" | grep -v POT-Creation-Date | grep '^[+|-][^+|-]') ]] | |
then | |
git add "Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot" | |
git commit -m "Update client en_US pot" -m "[ci skip]" | |
fi | |
# Check that diff contains something and it's not only POT-Creation-Date | |
if [[ $(git diff --unified=0 "Shared/installer/locale/en_US.pot" | grep -v POT-Creation-Date | grep '^[+|-][^+|-]') ]] | |
then | |
git add "Shared/installer/locale/en_US.pot" | |
git commit -m "Update installer en_US pot" -m "[ci skip]" | |
fi | |
# Check for local commits | |
if [[ $(git diff --name-only "@{upstream}..") ]] | |
then | |
echo "has_changes=true" >> $GITHUB_ENV | |
else | |
echo "has_changes=false" >> $GITHUB_ENV | |
fi | |
# Get rid of all other changes | |
git checkout -- . | |
git clean -fd | |
- if: ${{ env.has_changes == 'true' }} | |
name: Push changes | |
run: git push |