-
Notifications
You must be signed in to change notification settings - Fork 57
94 lines (81 loc) · 3.1 KB
/
crowdin-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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Crowdin Download
on:
# Allow manually triggering as well
workflow_dispatch:
# Run automatically in the middle of each month (we do it manually at the beginning)
schedule:
- cron: '0 0 15 * *'
env:
L10N_BRANCH_NAME: l10n_main
permissions: write-all
jobs:
crowdin-download:
name: Crowdin Download & Pull Request
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "current_date=$(date +'%-d %B %Y')" >> $GITHUB_OUTPUT
- name: Generate pull request title
id: pr-title
run: echo "pr_title=Crowdin translations for ${{ steps.date.outputs.current_date }}" >> $GITHUB_OUTPUT
- name: Generate PR branch name
id: branch-name
run: echo "branch_name=l10n-main-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3
- name: Synchronize with Crowdin
uses: crowdin/github-action@v1
with:
upload_sources: false
upload_translations: false
download_translations: true
skip_untranslated_strings: true
export_only_approved: true
create_pull_request: false
push_translations: false
env:
GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Validate & post-process
run: python crowdin.py --delete-untranslated --crowdin-cli
continue-on-error: false
- name: Ensure user owns everything
run: sudo chown -R $USER:$USER .
- name: Add new files & create pull
id: new-files
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.REPO_GITHUB_TOKEN }}
commit-message: ${{ steps.pr-title.outputs.pr_title }}
base: main
branch: ${{ steps.branch-name.outputs.branch_name }}
delete-branch: true
title: ${{ steps.pr-title.outputs.pr_title }}
body: ${{ steps.pr-title.outputs.pr_title }} (automated)
add-paths: |
iNaturalist/src/main/res/values-**/strings.xml
- name: Print PR number & SHA
env:
number: ${{ steps.new-files.outputs.pull-request-number }}
sha: ${{ steps.new-files.outputs.pull-request-head-sha }}
run: echo "Pull Request ${number} (${sha})"
# Let's try it without this first to see how it goes. This will merge even if tests fail.
# - name: Merge Pull Request
# uses: juliangruber/merge-pull-request-action@v1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# number: ${{ steps.new-files.outputs.pull-request-number }}
# method: squash
notify:
name: Notify Slack
needs: crowdin-download
if: ${{ success() || failure() }}
runs-on: ubuntu-latest
steps:
- uses: iRoachie/[email protected]
if: env.SLACK_WEBHOOK_URL != null
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILDS_WEBHOOK_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}