name: Update locales on: schedule: - cron: "0 0 * * 5" # Every Friday at midnight UTC workflow_dispatch: # Allow manual triggering permissions: contents: read jobs: update-locales: name: Update locales runs-on: ubuntu-latest environment: sync_l10n steps: - name: Generate app token id: app-token uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 with: client-id: ${{ secrets.CLIENT_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: token: ${{ steps.app-token.outputs.token }} persist-credentials: false - name: Use Node.js LTS uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: lts/* cache: 'npm' - name: Install dependencies run: npm ci - name: Import translations from mozilla-central run: npx gulp importl10n - name: Create Pull Request env: GH_TOKEN: ${{ steps.app-token.outputs.token }} run: | if [ -z "$(git status --porcelain l10n/)" ]; then echo "No locale changes to commit." exit 0 fi git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}" git switch -C update-locales git add l10n/ git commit -m "l10n: Update locale files" git push --force origin update-locales gh pr create \ --title "l10n: Update locale files" \ --body "Automated weekly update of locale files from mozilla-central." \ --label l10n || true