-
Notifications
You must be signed in to change notification settings - Fork 1k
67 lines (62 loc) · 2.85 KB
/
check-translations.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
name: Check Missing Translations
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
paths:
- '**/Localizable.strings' # Only run this check if localized string files have changed, exclude non-payments projects.
- '!StripeFinancialConnections/**'
- '!StripeIdentity/**'
- '!StripeConnections/**'
jobs:
check-translations:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- name: Install dependencies
run: gem install net-http net-uri json
- name: Run translation check script
env:
LOKALISE_API_KEY: ${{ secrets.LOKALISE_API_KEY_READONLY }}
run: ruby ci_scripts/check_for_untranslated_strings.rb
- name: Read missing translations
id: missing
run: echo "::set-output name=translations::$(<missing_translations.txt)"
- name: Exit if no missing translations
id: check_translations
run: |
if [ -z "${{ steps.missing.outputs.translations }}" ]; then
echo "No missing translations found, exiting..."
exit 0
else
echo "Missing translations detected, continue workflow..."
fi
- uses: peter-evans/find-comment@v3.0.0
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Missing Translations
- uses: peter-evans/create-or-update-comment@v4
if: steps.missing.outputs.translations
with:
body: |
⚠️ Missing Translations
The following strings have been uploaded to Lokalise but are not yet translated.
${{ steps.missing.outputs.translations }}
If it's okay for these strings to be unlocalized in master (e.g. this is for an unshipped feature), add the label `ship without translations` to acknowledge that there are missing translations. Otherwise, wait until translations are available in Lokalise and re-run this job.
New strings are localized on a weekly basis and are downloaded as part of the release process. For more details on how to localize a string, you can refer to [this link](https://trailhead.corp.stripe.com/docs/mobile-sdk/shared-infrastructure/mobile-sdk-localizations).
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fail if not accepted
if: "steps.missing.outputs.translations && !contains(github.event.pull_request.labels.*.name, 'ship without translations')"
run: exit 1