Pull translations from Transifex #671
This file contains hidden or 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: "Pull translations from Transifex" | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 3 * * *" | |
| jobs: | |
| pull-translations: | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| ref: "master" | |
| persist-credentials: false | |
| - name: l10n-pull | |
| uses: transifex/cli-action@584fd205cbe598773b5a81ce711fa44842678189 # v2 | |
| with: | |
| token: ${{ secrets.TX_TOKEN }} | |
| args: pull --force --skip --all | |
| - name: l10n-format | |
| shell: bash | |
| run: | | |
| beautifyJSON() { | |
| jq --sort-keys 'walk(if type == "object" then del(."th_TH", ."pt_PT", ."pt_BR", ."nn_NO", ."nb_NO", ."en_GB") else . end)' "$1" >"$1.tmp" | |
| mv "$1.tmp" "$1" | |
| } | |
| beautifyJSON "ownCloudSDK/Resources/Localizable.xcstrings" | |
| beautifyJSON "ownCloudUI/Resources/Localizable.xcstrings" | |
| - name: Setup Swift | |
| uses: swift-actions/setup-swift@7ca6abe6b3b0e8b5421b88be48feee39cbf52c6a # v2.4.0 | |
| - name: Build ocstringstool | |
| run: | | |
| swift -v | |
| swiftc tools/ocstringstool/ocstringstool/main.swift -o /tmp/ocstringstool | |
| - name: Run ocstringstool | |
| run: /tmp/ocstringstool normalize "ownCloudSDK/Resources" "ownCloudUI/Resources" | |
| - name: Generate GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6 | |
| with: | |
| app-id: ${{ secrets.TRANSLATION_APP_ID }} | |
| private-key: ${{ secrets.TRANSLATION_APP_PRIVATE_KEY }} | |
| - name: Create or update translations PR | |
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| branch: chore/translations-update | |
| base: master | |
| commit-message: "chore: update translations from transifex" | |
| title: "chore: update translations from transifex" | |
| body: "Automated translation update from Transifex. This pull request is updated on each sync run β merging it will close it and a fresh one will be opened on the next change." | |
| delete-branch: true | |
| sign-commits: true |