build(deps): bump actions/checkout
Bumps the github-actions group with 1 update in the / directory: [actions/checkout](https://github.com/actions/checkout).
Updates `actions/checkout` from 6.0.1 to 6.0.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8e8c483db8...de0fac2e45)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-version: 6.0.2
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: github-actions
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
104 lines
2.8 KiB
YAML
104 lines
2.8 KiB
YAML
---
|
|
name: localize
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- '.github/workflows/localize.yml'
|
|
- 'src/**'
|
|
- 'locale/sunshine.po'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
FILE: ./locale/sunshine.po
|
|
|
|
jobs:
|
|
localize:
|
|
name: Update Localization
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Install Python 3.9
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: '3.9'
|
|
|
|
- name: Set up Python 3.9 Dependencies
|
|
run: |
|
|
cd ./scripts
|
|
python -m pip install --upgrade pip setuptools
|
|
python -m pip install -r requirements.txt
|
|
|
|
- name: Set up xgettext
|
|
run: |
|
|
sudo apt-get update -y && \
|
|
sudo apt-get --reinstall install -y \
|
|
gettext
|
|
|
|
- name: Update Strings
|
|
run: |
|
|
new_file=true
|
|
|
|
# first, try to remove existing file as xgettext does not remove unused translations
|
|
if [ -f "${FILE}" ];
|
|
then
|
|
rm "${FILE}"
|
|
new_file=false
|
|
fi
|
|
echo "NEW_FILE=${new_file}" >> "${GITHUB_ENV}"
|
|
|
|
# extract the new strings
|
|
python ./scripts/_locale.py --extract
|
|
|
|
- name: git diff
|
|
if: env.NEW_FILE == 'false'
|
|
run: |
|
|
# disable the pager
|
|
git config --global pager.diff false
|
|
|
|
# print the git diff
|
|
git diff locale/sunshine.po
|
|
|
|
# set the variable with minimal output, replacing `\t` with ` `
|
|
OUTPUT=$(git diff --numstat locale/sunshine.po | sed -e "s#\t# #g")
|
|
echo "GIT_DIFF=${OUTPUT}" >> "${GITHUB_ENV}"
|
|
|
|
- name: git reset
|
|
# only run if a single line changed (date/time) and file already existed
|
|
if: >-
|
|
env.GIT_DIFF == '1 1 locale/sunshine.po' &&
|
|
env.NEW_FILE == 'false'
|
|
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@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
|
|
with:
|
|
add-paths: |
|
|
locale/*.po
|
|
token: ${{ secrets.GH_BOT_TOKEN }} # must trigger PR tests
|
|
commit-message: "chore(l10n): new babel updates"
|
|
branch: localize/update
|
|
delete-branch: true
|
|
base: master
|
|
title: "chore(l10n): 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
|