Skip to content

Commit 624e5d5

Browse files
committed
consolidate translation marking workflow into deploy process
1 parent f48af20 commit 624e5d5

File tree

2 files changed

+64
-78
lines changed

2 files changed

+64
-78
lines changed

.github/workflows/deploy-web.yml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- master
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
deploy:
1013
name: Deploy frontend
@@ -16,7 +19,67 @@ jobs:
1619
workflow_id: 42688838
1720
access_token: ${{ github.token }}
1821

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 }}
2083
2184
- name: Cache ~/.npm for npm ci
2285
uses: actions/cache@v4

.github/workflows/stale-translations.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)