Skip to content

Commit cc488ec

Browse files
authored
Merge pull request #945 from meowmeowmeowcat/Github-Action-Translation
2 parents 1bab44c + 563a2a2 commit cc488ec

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/translation.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Translation
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- Test
7+
branches:
8+
- main
9+
types:
10+
- completed
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Grab the repo src
18+
uses: actions/checkout@v2
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: 3.9
24+
25+
- name: Install Python tooling
26+
run: python -m pip install --upgrade nox virtualenv
27+
28+
- name: Generate a fresh POT file out of RST documents
29+
run: python -m nox -s translation
30+
31+
- name: Commit the POT file to Git
32+
run: |
33+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
34+
git config --local user.name "github-actions[bot]"
35+
git_hash=$(git rev-parse --short "${GITHUB_SHA}")
36+
git commit -m "Update messages.pot as of version ${git_hash}" locales/messages.pot
37+
38+
- name: Check if any sources have changed since the last update
39+
if: failure()
40+
run: echo "There are no changes to the RST sources since the last update. Nothing to do."
41+
42+
- name: >-
43+
Push the updated POT file back to
44+
${{ github.repository }}@${{ github.event.repository.default_branch }}
45+
on GitHub
46+
run: |
47+
git push --atomic origin HEAD:${{ github.event.repository.default_branch }}

0 commit comments

Comments
 (0)