Extract Strings #288
This file contains 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
name: Extract Strings | |
on: | |
schedule: | |
- cron: '0 20 * * 1,4' # At 13:00 PDT on Mondays, Thursdays | |
workflow_dispatch: | |
jobs: | |
extract: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Linux packages | |
run: | | |
sudo apt update | |
sudo apt install gettext -y | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install global npm packages | |
run: | | |
npm install -g grunt-cli | |
- name: Clone l10n repository | |
uses: actions/checkout@v4 | |
with: | |
path: "fxa-l10n" | |
- name: Clone FxA code repository | |
uses: actions/checkout@v4 | |
with: | |
repository: "mozilla/fxa" | |
fetch-depth: 1 | |
path: "fxa-code" | |
- name: Install npm packages | |
run: | | |
cd fxa-l10n | |
npm install | |
- name: Extract strings | |
run: | | |
cd fxa-code | |
_scripts/l10n/clone.sh | |
yarn workspaces focus fxa-content-server fxa-auth-server fxa-payments-server fxa-settings | |
yarn workspace fxa-payments-server grunt merge-ftl | |
yarn workspace fxa-settings grunt merge-ftl | |
yarn workspace fxa-auth-server grunt merge-ftl | |
yarn workspace fxa-react grunt merge-ftl | |
NODE_ENV=development ../fxa-l10n/scripts/extract_strings.sh \ | |
--mailer-repo ./packages/fxa-auth-server \ | |
--payments-repo ./packages/fxa-payments-server \ | |
--content-repo ./packages/fxa-content-server \ | |
--settings-repo ./packages/fxa-settings \ | |
--react-repo ./packages/fxa-react \ | |
--shared-repo ./libs/shared \ | |
--l10n-repo ../fxa-l10n | |
- name: Commit changes and open pull request | |
run: | | |
# Only try to commit if there are pending changes | |
cd fxa-l10n | |
if [[ $(git diff --exit-code) || $(git ls-files --other --exclude-standard) ]] | |
then | |
git config --global user.email '[email protected]' | |
git config --global user.name 'Bug Mirror' | |
# Random release number to avoid collision with old trains or branches | |
TRAIN_NUMBER=$(( $RANDOM + $RANDOM + 1000 )) | |
git checkout -B "merge-train-$TRAIN_NUMBER-strings" | |
git add . | |
git commit -m "Merge strings for train $TRAIN_NUMBER" | |
git push -f origin "merge-train-$TRAIN_NUMBER-strings" | |
# Create pull request, use the last commit message as title | |
gh pr create --fill | |
else | |
echo "No changes found." | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.FXA_GITHUB_TOKEN }} |