-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Github action to automatically generate mo files
- Loading branch information
1 parent
16c347a
commit 652e491
Showing
1 changed file
with
57 additions
and
0 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,57 @@ | ||
name: Update translations | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- po/* | ||
- README.md | ||
- wsl-pro-service/debian/control | ||
|
||
jobs: | ||
update-po: | ||
name: Update po files | ||
runs-on: ubuntu-latest | ||
env: | ||
modified: false | ||
steps: | ||
- name: Install dependencies | ||
run: | | ||
sudo DEBIAN_FRONTEND=noninteractive apt update | ||
sudo DEBIAN_FRONTEND=noninteractive apt install -y gettext | ||
- uses: actions/checkout@v3 | ||
name: Check out repo | ||
with: | ||
ref: main | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: common/go.mod | ||
- name: Check po files | ||
id: checkpo | ||
run: | | ||
set -eu | ||
hasModif="false" | ||
go generate common/i18n/i18n.go | ||
# Exclude line diffs only | ||
MODIFIED=$(git difftool -y -x "diff -Nup -I '^#: '" po/) | ||
if [ -n "$MODIFIED" ]; then | ||
hasModif="true" | ||
fi | ||
echo "modified=${hasModif}" >> $GITHUB_ENV | ||
- name: Create Pull Request | ||
if: ${{ env.modified == 'true' }} | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
commit-message: Auto update po files | ||
title: Auto update po files | ||
labels: po, automated pr | ||
body: "[Auto-generated pull request](https://github.com/canonical/ubuntu-pro-for-windows/actions/workflows/auto-updates.yaml) by GitHub Action" | ||
branch: auto-update/po | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push branch | ||
if: ${{ env.modified == 'true' }} | ||
run: | | ||
git push origin auto-update/po:main |