|
5 | 5 | branches: |
6 | 6 | - master |
7 | 7 |
|
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
8 | 11 | jobs: |
9 | 12 | deploy: |
10 | 13 | name: Deploy frontend |
|
16 | 19 | workflow_id: 42688838 |
17 | 20 | access_token: ${{ github.token }} |
18 | 21 |
|
19 | | - - uses: actions/checkout@v4 |
| 22 | + - name: Checkout repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Set up Node.js |
| 28 | + uses: actions/setup-node@v4 |
| 29 | + with: |
| 30 | + node-version: '18' |
| 31 | + |
| 32 | + - name: Get changed English documentation files |
| 33 | + id: changed-files |
| 34 | + run: | |
| 35 | + set -euo pipefail |
| 36 | + BEFORE="${{ github.event.before }}" |
| 37 | + if git rev-parse "$BEFORE^{commit}" >/dev/null 2>&1; then |
| 38 | + DIFF_BASE="$BEFORE" |
| 39 | + else |
| 40 | + DIFF_BASE="" |
| 41 | + fi |
| 42 | +
|
| 43 | + if [ -n "$DIFF_BASE" ]; then |
| 44 | + CHANGED_FILES=$(git diff --name-only "$DIFF_BASE" "${{ github.sha }}" | grep "^frontend/docs/.*\.md$" || true) |
| 45 | + else |
| 46 | + CHANGED_FILES=$(git ls-tree --name-only -r "${{ github.sha }}" | grep "^frontend/docs/.*\.md$" || true) |
| 47 | + fi |
| 48 | +
|
| 49 | + if [ -z "$CHANGED_FILES" ]; then |
| 50 | + echo "has_changes=false" >> "$GITHUB_OUTPUT" |
| 51 | + else |
| 52 | + printf '%s\n' "$CHANGED_FILES" > changed_english_docs.txt |
| 53 | + echo "has_changes=true" >> "$GITHUB_OUTPUT" |
| 54 | + fi |
| 55 | +
|
| 56 | + - name: Mark translations as outdated |
| 57 | + if: steps.changed-files.outputs.has_changes == 'true' |
| 58 | + run: | |
| 59 | + node .github/workflows/scripts/mark-translations-outdated.js |
| 60 | +
|
| 61 | + - name: Check if translations were modified |
| 62 | + if: steps.changed-files.outputs.has_changes == 'true' |
| 63 | + id: check-changes |
| 64 | + run: | |
| 65 | + if [ -n "$(git status --porcelain)" ]; then |
| 66 | + echo "translations_modified=true" >> "$GITHUB_OUTPUT" |
| 67 | + else |
| 68 | + echo "translations_modified=false" >> "$GITHUB_OUTPUT" |
| 69 | + fi |
| 70 | +
|
| 71 | + - name: Commit changes |
| 72 | + if: steps.check-changes.outputs.translations_modified == 'true' |
| 73 | + run: | |
| 74 | + git config --local user.email "[email protected]" |
| 75 | + git config --local user.name "omp-bot" |
| 76 | + git add frontend/i18n/ |
| 77 | + git commit -m "Mark translations as potentially outdated (post-merge)" |
| 78 | +
|
| 79 | + - name: Push changes |
| 80 | + if: steps.check-changes.outputs.translations_modified == 'true' |
| 81 | + run: | |
| 82 | + git push origin HEAD:${{ github.ref }} |
20 | 83 |
|
21 | 84 | - name: Cache ~/.npm for npm ci |
22 | 85 | uses: actions/cache@v4 |
|
0 commit comments