New declaration review page action UI #6613
Workflow file for this run
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
| # This Source Code Form is subject to the terms of the Mozilla Public | |
| # License, v. 2.0. If a copy of the MPL was not distributed with this | |
| # file, You can obtain one at https://mozilla.org/MPL/2.0/. | |
| # | |
| # OpenCRVS is also distributed under the terms of the Civil Registration | |
| # & Healthcare Disclaimer located at http://opencrvs.org/license. | |
| # | |
| # Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | |
| name: Check Missing Translation | |
| on: | |
| pull_request: | |
| branches: | |
| - '*' | |
| jobs: | |
| check-missing-translation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create directory for core and countryconfig | |
| run: | | |
| mkdir -m 777 -p $HOME/core | |
| mkdir -m 777 -p $HOME/countryconfig | |
| - name: Clone countryconfig and check if there any branch exists with the same name like current branch | |
| id: set_branch | |
| run: | | |
| cd $HOME/countryconfig | |
| git clone https://github.com/opencrvs/opencrvs-countryconfig.git | |
| cd opencrvs-countryconfig | |
| if [ -n "$(git branch -a | grep ${{ github.head_ref }})" ]; then | |
| working_branch=${{ github.head_ref }} | |
| elif [ -n "$(git branch -a | grep ${{ github.base_ref }})" ]; then | |
| working_branch=${{ github.base_ref }} | |
| else | |
| working_branch='develop' | |
| fi | |
| echo "Using branch $working_branch from countryconfig" | |
| echo "working_branch=$working_branch" >> $GITHUB_OUTPUT | |
| git checkout $working_branch | |
| # Sync countryconfig with develop, so we get both the newest changes from develop and the changes from working branch | |
| if [ "$working_branch" != "develop" ]; then | |
| echo "Syncing countryconfig branch '$working_branch' with 'develop'" | |
| # Unfortunately the merge requires user.name and email to be set here | |
| git config --local user.name "OpenCRVS Bot" | |
| git config --local user.email "[email protected]" | |
| if git merge origin/develop --no-commit --no-ff; then | |
| echo "Successfully synced countryconfig branch '$working_branch' with 'develop'" | |
| else | |
| # If there are merge conflicts in the translation file, abort the merge | |
| if git diff --name-only --diff-filter=U | grep -q "src/translations/client.csv"; then | |
| echo "Found merge conflicts in src/translations/client.csv, aborting merge" | |
| git merge --abort | |
| else | |
| echo "No conflicts in translations file, continuing" | |
| fi | |
| fi | |
| fi | |
| echo "countryconfig_path=$HOME/countryconfig/opencrvs-countryconfig" >> $GITHUB_OUTPUT | |
| - name: Checkout core repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: opencrvs/opencrvs-core | |
| ref: ${{ github.head_ref }} | |
| - name: Setup Node.js from core nvmrc | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Install dependencies and check for missing translations | |
| run: | | |
| export COUNTRY_CONFIG_PATH=${{steps.set_branch.outputs.countryconfig_path}} | |
| yarn install | |
| cd ./packages/client | |
| CI=true yarn extract:translations 2>&1 | tee output.txt | |
| if grep -q "Missing translations" output.txt; then | |
| awk '/You are missing the following content keys from your country configuration package:/ {flag=1; next} /Add them to this file and run again:/ {flag=0} flag' output.txt > missing_translations.txt | |
| sed -i '/^$/d' missing_translations.txt | |
| echo "### Summary Of Missing Translation" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| cat missing_translations.txt >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| echo "Create a pull request to the \`opencrvs/countryconfig\` repository with a branch name ${{ github.head_ref }} and add the translations to \`src/translations/client.csv\`. After pushing the changes, you can run this pipeline again." >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi |