Skip to content

Commit

Permalink
Implemented Github action to automatically generate mo files
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Mar 29, 2023
1 parent 16c347a commit 652e491
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/auto-updates.yaml
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

0 comments on commit 652e491

Please sign in to comment.