-
-
Notifications
You must be signed in to change notification settings - Fork 29
34 lines (34 loc) · 1.6 KB
/
lokalise-download.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
name: Download Lokalise translations
on:
schedule:
- cron: "0 2 * * 2"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lokalise CLI
run: curl -sfL https://raw.githubusercontent.com/lokalise/lokalise-cli-2-go/master/install.sh | sh
- name: Pull
env:
VAR_LOKALISE_API_TOKEN: ${{ secrets.LOKALISE_RO_API_TOKEN }}
VAR_LOKALISE_PROJECT_ID: ${{ secrets.LOKALISE_PROJECT_ID }}
run: |
./bin/lokalise2 --token ${{ env.VAR_LOKALISE_API_TOKEN }} --project-id ${{ env.VAR_LOKALISE_PROJECT_ID }} file download --format json --export-empty-as skip --export-sort first_added --placeholder-format printf --plural-format array --indentation 4sp --directory-prefix src/translations
- name: Create Pull Request
env:
GH_TOKEN: ${{ github.token }}
GITHUB_NEW_BRANCH_NAME: Lokalise-${{ github.run_id }}${{ github.run_attempt }}
run: |
git checkout -b ${{ env.GITHUB_NEW_BRANCH_NAME }}
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add ./\*.json
if [[ -z $(git status --untracked-files=no --porcelain) ]]
then
echo "No changes"
else
git commit -m 'Translations update'
git push --set-upstream origin ${{ env.GITHUB_NEW_BRANCH_NAME }}
gh pr create --base main --head ${{ env.GITHUB_NEW_BRANCH_NAME }} --title "Lokalise translations update" --body ""
fi