keyguard-app-Bitwarden-Vaul.../.github/workflows/update_localization.yml

72 lines
2.6 KiB
YAML

name: "🌐 Synchronize Localization"
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'common/src/commonMain/composeResources/values/*.xml'
- 'listing/google/base/*.html'
- 'listing/google/base/*.xml'
# Configuration.
- 'crowdin.yml'
jobs:
sync-localization:
name: Synchronize Crowdin Translations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install -r .github/update_localization_contributors.requirements.txt
- uses: crowdin/github-action@v2
with:
upload_sources: true
# We only want to upload the sources, nothing else is
# supported.
upload_translations: false
download_translations: true
config: 'crowdin.yml'
create_pull_request: false
push_translations: false
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
# https://github.com/crowdin/github-action/issues/229
- name: Fix permissions Crowdin created
run: |
sudo chmod -R 666 common/src/commonMain/composeResources/values-*/*.xml
- name: "Update library"
run: |
python .github/update_localization.py
- name: "Update contributors"
run: |
python .github/update_localization_contributors.py ${{ secrets.CROWDIN_PERSONAL_TOKEN }} ${{ secrets.CROWDIN_PROJECT_ID }}
- name: "Check if any changes"
id: check-changes
run: |
has_changes=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)
echo "$has_changes"
echo "HAS_CHANGES=$has_changes" >> "$GITHUB_OUTPUT"
- name: Commit and push changes
uses: devops-infra/action-commit-push@v0.9.2
if: ${{ startsWith(steps.check-changes.outputs.HAS_CHANGES, 'true') }}
with:
github_token: "${{ secrets.PERSONAL_TOKEN }}"
add_timestamp: false
commit_prefix: "[AUTO]"
commit_message: "Update localization library"
force: true
target_branch: localization_action
- name: Create pull request
uses: devops-infra/action-pull-request@v0.5.5
if: ${{ startsWith(steps.check-changes.outputs.HAS_CHANGES, 'true') }}
with:
github_token: "${{ secrets.PERSONAL_TOKEN }}"
source_branch: localization_action
target_branch: master
assignee: AChep
label: "robot,enhancement"
title: New Crowdin translations by GitHub Action