Skip to content

Commit 542d3c7

Browse files
committed
feat: add workflow for flagging non-English PRs
1 parent c3afcfb commit 542d3c7

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Check for non-English updates outside of Crowdin
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "public/content/translations/**"
7+
- "src/intl/**/*.json"
8+
- "!src/intl/en/**"
9+
10+
jobs:
11+
check_branch_name:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Exit early if branch name contains 'crowdin'
15+
run: |
16+
if [[ "${{ github.head_ref }}" == *crowdin* ]]; then
17+
echo "Branch name contains 'crowdin', stopping workflow"
18+
exit 1
19+
fi
20+
21+
add_label_and_comment:
22+
needs: check_branch_name
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Add label and comment
26+
uses: actions/github-script@v5
27+
with:
28+
github-token: ${{secrets.GITHUB_TOKEN}}
29+
script: |
30+
const prNumber = context.issue.number;
31+
const repo = context.repo;
32+
await github.rest.issues.addLabels({
33+
...repo,
34+
issue_number: prNumber,
35+
labels: ['blocked 🛑', 'non-crowdin translation updates']
36+
});
37+
await github.rest.issues.createComment({
38+
...repo,
39+
issue_number: prNumber,
40+
body: `Thank you for your contribution!
41+
All updates to non-English content must be handled through Crowdin.
42+
We value your suggestion and request that you learn more about how to [help us translate](https://ethereum.org/en/contributing/translation-program/#help-us-translate), and suggest these updates directly in [our Crowdin project](https://crowdin.com/project/ethereum-org) where they can be properly reviewed.
43+
Please join [our Discord](https://ethereum.org/discord) if you have questions!`
44+
});

src/scripts/crowdin/translations/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const createLocaleTranslationPR = (
7373
.toLowerCase()
7474
const timestamp = new Date().toISOString().replace(/[^0-9]/g, "")
7575

76-
const branchName = `${month}-${locale}-${timestamp}`
76+
const branchName = `crowdin-${month}-${locale}-${timestamp}`
7777
const message = `chore: import translations for ${locale}`
7878
const startingBranch = execSync("git branch --show-current", {
7979
encoding: "utf-8",

0 commit comments

Comments
 (0)