mirror of
https://github.com/scratchfoundation/scratch-l10n.git
synced 2024-12-22 21:52:35 -05:00
6192ffed75
Previously, this was using outdated and 'insecure' syntax for setting an environment variable. More info here: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ This could have been solved by using `echo STUFF >> "$GITHUB_ENV"` but I think using a step output is even better, mainly because it's more clear what kind of changes `MADE_CHANGES` is talking about. I also reordered the commands so that if writing the step output fails, the step will fail before pushing the changes. That means we'll no longer end up with half-released changes (released on GitHub but not NPM).
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
name: Daily TX Pull
|
|
|
|
on:
|
|
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
|
|
schedule:
|
|
# daily-tx-pull (e.g., daily at 3 AM UTC)
|
|
- cron: "0 3 * * *"
|
|
|
|
concurrency:
|
|
group: "${{ github.workflow }}"
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: write # publish a GitHub release
|
|
pages: write # deploy to GitHub Pages
|
|
issues: write # comment on released issues
|
|
pull-requests: write # comment on released pull requests
|
|
|
|
jobs:
|
|
daily-tx-pull:
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
# Organization-wide secrets
|
|
TX_TOKEN: ${{ secrets.TX_TOKEN }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
cache: "npm"
|
|
node-version-file: ".nvmrc"
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Pull editor and www translations
|
|
run: |
|
|
npm run pull:editor
|
|
npm run pull:www
|
|
npm run test
|
|
|
|
- name: Commit translation updates
|
|
id: commit
|
|
run: |
|
|
git config --global user.email $(git log --pretty=format:"%ae" -n1)
|
|
git config --global user.name $(git log --pretty=format:"%an" -n1)
|
|
git add .
|
|
if git diff --cached --exit-code --quiet; then
|
|
echo "MADE_CHANGES=false" >> "$GITHUB_OUTPUT"
|
|
echo "Nothing to commit."
|
|
else
|
|
git commit -m "pull new editor translations from Transifex"
|
|
echo "MADE_CHANGES=true" >> "$GITHUB_OUTPUT"
|
|
git push origin HEAD:master
|
|
fi
|
|
- name: Start CI/CD workflow if changes were made
|
|
if: steps.commit.outputs.MADE_CHANGES == 'true'
|
|
uses: ./.github/workflows/ci-cd.yml
|