Skip to content

Commit 91ea600

Browse files
ci: open PR for translation updates instead of pushing directly (#12496)
1 parent c6e4d2b commit 91ea600

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

.github/workflows/translate.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ permissions: {}
1010
jobs:
1111
update-translations:
1212
permissions:
13-
# for git push
14-
contents: write
13+
contents: read
1514
strategy:
1615
matrix:
1716
# current transifex plan only allows 1 additional branch
@@ -25,10 +24,10 @@ jobs:
2524
steps:
2625
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2726
with:
28-
ssh-key: ${{ secrets.DEPLOYMENT_SSH_KEY }}
2927
submodules: recursive
3028
fetch-depth: 0
3129
ref: ${{ matrix.branch }}
30+
persist-credentials: false
3231

3332
- name: install-deps
3433
run: sudo apt install -y qt6-l10n-tools
@@ -72,14 +71,21 @@ jobs:
7271
token: ${{ secrets.TX_TOKEN }}
7372
args: pull --force --all --silent
7473

75-
- name: Push
76-
run: |
77-
git config user.name "ownClouders"
78-
git config user.email "devops@owncloud.com"
79-
git add translations
80-
if git diff --staged --quiet; then
81-
echo "No changes to commit"
82-
exit 0
83-
fi
84-
git commit -m "[tx] updated translations from transifex"
85-
git push origin ${{ matrix.branch }}
74+
- name: Generate GitHub App token
75+
id: app-token
76+
uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6
77+
with:
78+
app-id: ${{ secrets.TRANSLATION_APP_ID }}
79+
private-key: ${{ secrets.TRANSLATION_APP_PRIVATE_KEY }}
80+
81+
- name: Create or update translations PR
82+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
83+
with:
84+
token: ${{ steps.app-token.outputs.token }}
85+
branch: chore/translations-update-${{ matrix.branch }}
86+
base: ${{ matrix.branch }}
87+
commit-message: "chore: update translations from transifex"
88+
title: "chore: update translations from transifex"
89+
body: "Automated translation update from Transifex. This pull request is updated on each sync run — merging it will close it and a fresh one will be opened on the next change."
90+
delete-branch: true
91+
sign-commits: true

0 commit comments

Comments
 (0)