test #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ::set-output name=log::$body | |
- 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 }} |