name: i18n download strings on: workflow_dispatch: schedule: - cron: '0 10 * * 1' defaults: run: shell: bash permissions: contents: read jobs: download: name: 'Download latest strings' runs-on: ubuntu-latest environment: 'deploy-production' permissions: # Give the default GITHUB_TOKEN write permission to commit and push the # added or changed files to the repository. contents: write pull-requests: write repository-projects: write steps: - name: Check out code uses: actions/checkout@v6 with: fetch-depth: 1 - uses: ./.github/actions/setup - name: Download i18n strings run: 'yarn i18n-download-strings' env: LOKALISE_API_TOKEN: ${{ secrets.LOKALISE_API_TOKEN }} LOKALISE_PROJECT_ID: ${{ secrets.LOKALISE_PROJECT_ID }} LOKALISE_TLDRAW_PROJECT_ID: ${{ secrets.LOKALISE_TLDRAW_PROJECT_ID }} - name: Compile i18n strings run: 'yarn build-i18n' - name: Validate the strings run: 'yarn i18n-check -f react-intl --locales ./apps/dotcom/client/public/tla/locales/ --source en --only invalidKeys' - name: Commit and push changes env: GH_TOKEN: ${{ github.token }} run: | git config --global user.name 'huppy-bot[bot]' git config --global user.email '128400622+huppy-bot[bot]@users.noreply.github.com' # Check if there are any changes to JSON files if ! git diff --quiet '*.json' || ! git diff --cached --quiet '*.json'; then echo "Changes detected, creating PR..." else echo "No changes to commit" exit 0 fi # Delete the branch if it already exists git push origin --delete update-i18n-strings 2>/dev/null || true git checkout -b update-i18n-strings git add "*.json" git commit --no-verify -m '[automated] update i18n strings' git push --set-upstream origin update-i18n-strings gh pr create --title "[automated] update i18n strings" --body "This PR updates the i18n strings. ### Change type - [x] \`other\`" --base main --head update-i18n-strings