-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #670 from lslezak/master
Added weblate-update-pot.yml GitHub Action
- Loading branch information
Showing
5 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Weblate Update POT | ||
|
||
on: | ||
schedule: | ||
# run every working day (Monday-Friday) at 1:42AM UTC | ||
- cron: "42 1 * * 0-4" | ||
|
||
# allow running manually | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-pot: | ||
# do not run in forks | ||
if: github.repository == 'openSUSE/agama' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
container: | ||
image: registry.opensuse.org/opensuse/tumbleweed:latest | ||
|
||
steps: | ||
- name: Configure and refresh repositories | ||
# disable unused repositories to have a faster refresh | ||
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref | ||
|
||
- name: Install tools | ||
run: zypper --non-interactive install --no-recommends diffutils git gettext-tools | ||
|
||
- name: Checkout Agama sources | ||
uses: actions/checkout@v3 | ||
with: | ||
path: agama | ||
|
||
- name: Generate POT file | ||
# TODO: use a shared script for this | ||
run: | | ||
cd agama/web | ||
xgettext --default-domain=agama --output=- --language=C --keyword= \ | ||
--keyword=_:1,1t --keyword=_:1c,2,2t --keyword=C_:1c,2 \ | ||
--keyword=N_ --keyword=NC_:1c,2 --foreign-user \ | ||
--copyright-holder="SuSE Linux Products GmbH, Nuernberg" \ | ||
--from-code=UTF-8 --add-comments=TRANSLATORS --sort-by-file \ | ||
$(find . ! -name cockpit.js -name '*.js' -o ! -name '*.test.jsx' -name '*.jsx') | \ | ||
sed '/^#/ s/, c-format//' > agama.pot | ||
msgfmt --statistics agama.pot | ||
- name: Validate the generated POT file | ||
run: msgfmt --check-format agama/web/agama.pot | ||
|
||
- name: Checkout Weblate sources | ||
uses: actions/checkout@v3 | ||
with: | ||
path: agama-weblate | ||
repository: openSUSE/agama-weblate | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.name "YaST Bot" | ||
git config --global user.email "[email protected]" | ||
- name: Update POT file | ||
run: | | ||
mkdir -p agama-weblate/web | ||
cp agama/web/agama.pot agama-weblate/web/agama.pot | ||
# any change besides the timestamp in the POT file? | ||
- name: Check changes | ||
id: check_changes | ||
run: | | ||
git -C agama-weblate diff --ignore-matching-lines="POT-Creation-Date:" web/agama.pot > pot.diff | ||
if [ -s pot.diff ]; then | ||
echo "POT file updated" | ||
echo "pot_updated=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "POT file unchanged" | ||
echo "pot_updated=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Push updated POT file | ||
# run only when the POT file has been updated | ||
if: steps.check_changes.outputs.pot_updated == 'true' | ||
run: | | ||
cd agama-weblate | ||
git add web/agama.pot | ||
git commit -m "Update POT file"$'\n\n'"Agama commit: $GITHUB_SHA" | ||
git push |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
"filename", | ||
"fullname", | ||
"freedesktop", | ||
"gettext", | ||
"ibft", | ||
"ifaces", | ||
"ipaddr", | ||
|
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
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
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