pdf.js.mirror/.github/workflows/update_locales.yml
Calixte Denizet 9eb40abbae
Use a gh app for making the PR to update l10n data
It should help to avoid having the subsequent workflows being stuck.
2026-04-21 14:40:10 +02:00

62 lines
1.9 KiB
YAML

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@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.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