Files
Tim van der Meij a3b19875ec Implement Node.js caching in the GitHub Actions workflows
The `setup-node` action contains built-in support for caching [1], so
this commit makes sure we use it for all Node.js-based workflows to
reduce workflow execution time.

Note that, contrary what one might expect [2], the `node_modules`
directory is deliberately not cached because it can conflict with
differing Node.js versions and because it's not useful in combination
with `npm ci` usage which wipes the `node_modules` folder
unconditionally. Therefore, the action instead caches the global `npm`
cache directory instead which does not suffer from these problems and
still provides a speed-up at installation time.

[1] https://github.com/actions/setup-node?tab=readme-ov-file#caching-global-packages-data
[2] https://github.com/actions/setup-node/issues/416
[3] https://github.com/actions/cache/issues/67
2026-03-22 19:40:10 +01:00

53 lines
1.5 KiB
YAML

name: Update locales
on:
schedule:
- cron: "0 0 * * 5" # Every Friday at midnight UTC
workflow_dispatch: # Allow manual triggering
permissions:
contents: write
pull-requests: write
jobs:
update-locales:
name: Update locales
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: true
- name: Use Node.js LTS
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
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: ${{ secrets.GITHUB_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 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