Merge branch 'dev' into IN-982-location-org-attribute #4204
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 Action | |
on: | |
push: | |
branches-ignore: | |
- renovate/* | |
- l10n_* | |
pull_request: | |
types: | |
- closed | |
branches-ignore: | |
- main | |
- l10n_* | |
- renovate/* | |
workflow_dispatch: | |
schedule: | |
# ┌───────────── minute (0 - 59) | |
# │ ┌───────────── hour (0 - 23) | |
# │ │ ┌───────────── day of the month (1 - 31) | |
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
# │ │ │ │ │ | |
- cron: 0 8 * * * | |
jobs: | |
synchronize-with-crowdin: | |
name: Crowdin Actions | |
runs-on: ubuntu-latest | |
env: | |
HUSKY: 0 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6 | |
with: | |
gpg_private_key: ${{ secrets.BOT_GPG_KEY }} | |
git_user_signingkey: true | |
git_config_global: true | |
git_commit_gpgsign: true | |
git_committer_name: 'InReach [bot]' | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
run_install: | | |
args: [--global, "@crowdin/cli"] | |
- name: Install Node.js | |
if: github.event_name != 'pull_request' && !startsWith(github.ref_name, 'l10n_') | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
cache-dependency-path: pnpm-lock.yaml | |
- name: Remove Jira ticket ID from branch name | |
id: branchregex | |
uses: ashley-taylor/regex-property-action@eeec905bf940ec1c65ff777402c57f786368d9bc # v1.4 | |
with: | |
value: ${{ github.ref_name }} | |
regex: (IN|PLI)-\d+ | |
flags: gi | |
replacement: $1-xxx | |
- name: Sanitize github branch name | |
id: sanitizebranch | |
uses: ashley-taylor/regex-property-action@eeec905bf940ec1c65ff777402c57f786368d9bc # v1.4 | |
with: | |
value: ${{ github.head_ref || github.ref_name}} | |
regex: '[\\/:*?"<>|>]' | |
flags: gi | |
replacement: '_' | |
- name: Push sources to Crowdin | |
if: github.event_name != 'pull_request' && !startsWith(github.ref_name, 'l10n_') | |
env: | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
run: crowdin push sources -b ${{ steps.sanitizebranch.outputs.value }} --no-progress | |
- name: Synchronize sources to Crowdin | |
if: steps.sanitizebranch.outputs.value == 'main' | |
env: | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
run: crowdin push sources -b ${{ steps.sanitizebranch.outputs.value }} --no-progress | |
- name: Pull updated translations from Crowdin | |
if: (github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled' | |
env: | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
run: crowdin pull -b ${{ steps.sanitizebranch.outputs.value }} --no-progress | |
- name: Check for updated files | |
if: (github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled' | |
uses: tj-actions/verify-changed-files@6ed7632824d235029086612d4330d659005af687 # v20 | |
id: verify-changed-files | |
with: | |
files: '**/locales/*/*.json' | |
- name: Format json files | |
if: ((github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled') && steps.verify-changed-files.outputs.files_changed | |
working-directory: apps/app | |
id: run-prettier | |
run: | | |
echo 'Installing package dependencies' | |
pnpm install | |
echo 'Running prettier' | |
pnpm format | |
- name: Get files to commit | |
if: steps.run-prettier.conclusion == 'success' | |
uses: tj-actions/verify-changed-files@6ed7632824d235029086612d4330d659005af687 # v20 | |
id: get-pending-files | |
with: | |
separator: <br> | |
- name: Commit files | |
id: commit-files | |
if: ((github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled') && steps.verify-changed-files.outputs.files_changed | |
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6 | |
with: | |
token: ${{ secrets.GH_ACT_PAT }} | |
commit-message: Updated translations from Crowdin | |
committer: 'InReach [bot] <[email protected]>' | |
author: 'InReach [bot] <[email protected]>' | |
branch: ${{ format('l10n_{0}',steps.branchregex.outputs.value) }} | |
base: ${{ github.ref_name }} | |
title: 'chore(i18n): Updated translations from Crowdin' | |
labels: | | |
translations | |
kodiak: merge.method = 'squash' | |
automerge | |
delete-branch: true | |
add-paths: | | |
./**/locales/*/*.json | |
- name: Generate job summary | |
id: generate-job-summary | |
if: steps.commit-files.conclusion == 'success' | |
run: | | |
echo "# Job Summary" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "Pull request ${{steps.commit-files.outputs.pull-request-number}} has been ${{steps.commit-files.outputs.pull-request-operation}}" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "## Changed files:" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "${{ steps.get-pending-files.outputs.changed_files }}" >> $GITHUB_STEP_SUMMARY | |
- name: Delete Crowdin Branch | |
if: github.event_name == 'pull_request' && github.ref_name != 'l10n_dev' && steps.sanitizebranch.outputs.value != 'dev' && steps.sanitizebranch.outputs.value != 'main' | |
env: | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
run: crowdin branch delete ${{ steps.sanitizebranch.outputs.value }} --no-progress | |
- name: Generate OTA Release | |
if: github.event_name == 'schedule' | |
env: | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
run: | | |
crowdin distribution release ${{ secrets.CROWDIN_OTA_HASH }} --no-progress --verbose | |
crowdin distribution release ${{ secrets.CROWDIN_OTA_HASH_DB }} -i 24 --no-progress --verbose |