Skip to content

Commit 5e14855

Browse files
committed
Push i18n POT file to a separate branch
1 parent d4f4c0b commit 5e14855

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

.github/workflows/translation.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,46 @@ on:
99
types:
1010
- completed
1111

12+
env:
13+
I18N_BRANCH: translation/source
14+
1215
jobs:
1316
build:
1417
runs-on: ubuntu-latest
1518

1619
steps:
1720
- name: Grab the repo src
1821
uses: actions/checkout@v2
22+
with:
23+
fetch-depth: 0 # To reach the common commit
1924
- name: Setup git user as [bot]
2025
# Refs:
2126
# * https://github.community/t/github-actions-bot-email-address/17204/6
2227
# * https://github.com/actions/checkout/issues/13#issuecomment-724415212
2328
uses: fregante/setup-git-user@v1.0.1
2429

30+
- name: Switch to the translation source branch
31+
run: |
32+
sh -x
33+
34+
git fetch origin \
35+
'+refs/heads/${{
36+
env.I18N_BRANCH
37+
}}:refs/remotes/origin/${{
38+
env.SRC_BRANCH
39+
}}'
40+
41+
git checkout -B '${{ env.I18N_BRANCH }}' \
42+
'origin/${{ env.I18N_BRANCH }}'
43+
44+
- name: >-
45+
Merge '${{ github.event.repository.default_branch }}'
46+
to '${{ env.I18N_BRANCH }}'
47+
run: |
48+
sh -x
49+
50+
git merge '${{ github.event.repository.default_branch }}'
51+
2552
- name: Set up Python
2653
uses: actions/setup-python@v2
2754
with:
@@ -37,15 +64,12 @@ jobs:
3764
- name: Commit the POT file to Git
3865
run: |
3966
git_hash=$(git rev-parse --short "${GITHUB_SHA}")
40-
git commit -m "Update messages.pot as of version ${git_hash}" locales/messages.pot
41-
42-
- name: Check if any sources have changed since the last update
43-
if: failure()
44-
run: echo "There are no changes to the RST sources since the last update. Nothing to do."
67+
git commit \
68+
-m "Update messages.pot as of version ${git_hash}" \
69+
locales/messages.pot
4570
4671
- name: >-
47-
Push the updated POT file back to
48-
${{ github.repository }}@${{ github.event.repository.default_branch }}
49-
on GitHub
72+
Push the updated POT file back to '${{ env.I18N_BRANCH }}'
73+
branch on GitHub
5074
run: |
51-
git push --atomic origin HEAD:${{ github.event.repository.default_branch }}
75+
git push --atomic origin 'HEAD:${{ env.I18N_BRANCH }}'

0 commit comments

Comments
 (0)