Crowdin synchronization #264
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: Crowdin synchronization | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '2 */12 * * *' | |
push: | |
paths: [ | |
'swift-paperless/Localization/*.xcstrings', | |
] | |
branches: [ main ] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
synchronize-with-crowdin: | |
name: Crowdin Sync | |
runs-on: ubuntu-latest | |
env: | |
PRE_COMMIT_HOME: '/tmp/pre-commit' | |
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install pre-commit | |
run: | | |
pip install pre-commit | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.PRE_COMMIT_HOME }} | |
key: ${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Crowdin push | |
uses: crowdin/github-action@v2 | |
with: | |
command: push | |
- name: Crowdin pull | |
uses: crowdin/github-action@v2 | |
with: | |
command: pull | |
- name: Fix generated files | |
run: | | |
sudo chown $(whoami):$(whoami) swift-paperless/Localization/*.xcstrings | |
pre-commit run end-of-file-fixer --files swift-paperless/Localization/*.xcstrings || true | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
title: 'chore: Update localization' | |
commit-message: 'chore: Update localization' | |
branch: l18n_update | |
delete-branch: true | |
body: "Automated update of localizations from Crowdin" | |
base: main | |
add-paths: swift-paperless/Localization |