|
| 1 | +# This action automates the synchronization of our crowdin translations, so that a human does not need to kick it off from the crowdin UI |
| 2 | +# See translations-upload.yml for automation to upload our source content |
| 3 | +# See translations-pr-lint-and-format.yml for quality control we conduct on ingress of new translations. |
| 4 | +name: Crowdin Download |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: # Allow running when we want to, for events such as urgent translation mistakes or 100% completed languages |
| 8 | + schedule: |
| 9 | + - cron: '0 5 * * 5' # At 05:00 on Fridays. This guarantees that we have the 72 hour weekend time to review translations. |
| 10 | + |
| 11 | +# Cancel any runs on the same branch |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +permissions: |
| 17 | + # These permissions required by `crowdin/github-action` |
| 18 | + contents: write |
| 19 | + pull-requests: write |
| 20 | + |
| 21 | +jobs: |
| 22 | + synchronize-with-crowdin: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Harden Runner |
| 27 | + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 |
| 28 | + with: |
| 29 | + egress-policy: audit |
| 30 | + |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 33 | + |
| 34 | + # see all the options at https://github.com/crowdin/github-action |
| 35 | + - name: crowdin action |
| 36 | + uses: crowdin/github-action@2d540f18b0a416b1fbf2ee5be35841bd380fc1da # v2.3.0 |
| 37 | + with: |
| 38 | + # do not upload anything - this is a one-way operation download |
| 39 | + upload_sources: false |
| 40 | + upload_translations: false |
| 41 | + # the rest of this controls how the PR comes in with new translations |
| 42 | + download_translations: true |
| 43 | + localization_branch_name: chore/crowdin |
| 44 | + create_pull_request: true |
| 45 | + pull_request_title: '[automated]: crowdin sync' |
| 46 | + pull_request_body: 'New Crowdin translations from the [Node.js Crowdin project](https://crowdin.com/project/nodejs-web)' |
| 47 | + pull_request_labels: github_actions:pull-request |
| 48 | + commit_message: 'chore: synced translations from crowdin [skip ci]' |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + # A numeric ID, found at https://crowdin.com/project/nodejs-web/tools/api |
| 52 | + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} |
| 53 | + # Created from https://crowdin.com/settings#api-key logged in using nodejs-crowdin-bot |
| 54 | + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} |
0 commit comments