-
Notifications
You must be signed in to change notification settings - Fork 224
73 lines (61 loc) · 2.51 KB
/
Copy pathdaily-tx-pull.yml
File metadata and controls
73 lines (61 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
cache: 'npm'
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
# The pull steps replace any translation that fails validation with the previous translation or the source
# text, so the saved files are always valid. They exit non-zero when something was replaced; the validation and
# commit steps still run (via `!cancelled()`) so the good translations are committed, but the job ends red to
# flag the bad strings for fixing in Transifex.
- name: Pull editor translations
run: npm run pull:editor
- name: Pull www translations
if: ${{ !cancelled() }}
run: npm run pull:www
- name: Validate translations
id: validate
if: ${{ !cancelled() }}
run: npm run test
# Commit even when a pull step exited non-zero (only bad strings were replaced). Skip the commit only when
# validation actually failed - a problem the pull did not sanitize, which we should not commit.
- name: Commit translation updates
id: commit
if: ${{ !cancelled() && steps.validate.outcome == 'success' }}
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 "Nothing to commit."
else
git commit -m "fix: pull new editor translations from Transifex"
git push
fi
- uses: ./.github/actions/report-scheduled-issue
if: failure() && github.event_name == 'schedule'
with:
slack-webhook: ${{ secrets.SLACK_WEBHOOK_ENGINEERING }}
event: failed