-
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.84 KB
/
from-crowdin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Sync from Crowdin
on:
pull_request_target:
paths:
- json-translated/**
concurrency:
group: from-crowdin-pr-${{ github.event.pull_request.id }}
cancel-in-progress: true
jobs:
sync:
runs-on: ubuntu-22.04
steps:
- name: checkout repo
uses: actions/[email protected]
with:
ref: crowdin-service-branch
# only run on PRs from Meadowsys (id 49562048)
# (Crowdin PRs look like they come from the user that set up the integration)
- name: authenticate
id: authenticate
run: |
if [ ${{ github.event.pull_request.user.id }} -eq 49562048 ] && [ ${{ github.event.pull_request.base.ref }} == "master" ] && [ ${{ github.event.pull_request.head.ref }} == "crowdin-service-branch" ]; then
echo "authenticated=true" >> $GITHUB_OUTPUT
else
echo "authenticated=false" >> $GITHUB_OUTPUT
fi
- name: setup pnpm (yes)
if: ${{ steps.authenticate.outputs.authenticated == 'true' }}
uses: pnpm/[email protected]
with:
version: "8.5.1"
# safe enough to assume that there will be changes?
- name: update and commit CSON from translated JSON
if: ${{ steps.authenticate.outputs.authenticated == 'true' }}
run: |
pnpm i
rm -rf cson-translated
node script/translated-json-to-cson.mjs
git config --global user.name smol
git config --global user.email [email protected]
echo "https://meadowsys:${{ secrets.GITHUB_TOKEN }}@github.com" > .git/credentials
git config --global credential.helper "store --file=.git/credentials"
git config --unset-all http.https://github.com/.extraheader # https://stackoverflow.com/a/69979203
git add -A
git commit -m "(automated) updating CSON files from Crowdin translated JSON files"
git push