-
Notifications
You must be signed in to change notification settings - Fork 276
60 lines (60 loc) · 2.05 KB
/
localization-report.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
name: Localization report
on:
pull_request:
jobs:
'Checking':
runs-on: ubuntu-latest
steps:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Checkout repository
uses: actions/checkout@v2
with:
path: pr
- name: Checkout repository
uses: actions/checkout@v2
with:
path: main
ref: main
- name: Write localization target (with PR changes)
run: |
cd pr
python scripts/check_languages.py -raw_report ../target.json -report_key_mismatch -report_missing_translations
cd -
- name: Write localization baseline (without PR changes)
run: |
cd main
python scripts/check_languages.py -raw_report ../baseline.json -report_key_mismatch -report_missing_translations
cd -
- name: Compare reports using main
id: report
run: |
python main/scripts/compare_language_reports.py -output comparison.md -baseline baseline.json -target target.json
body=$(cat comparison.md)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "log=$body" >> $GITHUB_OUTPUT
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'time-to-leave[bot]'
body-includes: Localization report
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ steps.report.outputs.log }}
edit-mode: replace
token: ${{ steps.generate-token.outputs.token }}