-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
484ddb8
commit 54ecaa9
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Check Translation | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- gh-pages | ||
paths: | ||
- 'en/**' | ||
- 'es/**' | ||
- 'fr/**' | ||
- 'it/**' | ||
- 'ja/**' | ||
- 'ko/**' | ||
- 'pt-br/**' | ||
- 'ru/**' | ||
- 'sk/**' | ||
- 'th/**' | ||
- 'tr/**' | ||
- 'uk/**' | ||
- 'uz/**' | ||
- 'zh-cn/**' | ||
- 'zh-tw/**' | ||
|
||
jobs: | ||
check-translation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check modified files and add labels | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const languages = ['en', 'es', 'fr', 'it', 'ja', 'ko', 'pt-br', 'ru', 'sk', 'th', 'tr', 'uk', 'uz', 'zh-cn', 'zh-tw']; | ||
const { data: pullRequest } = await github.rest.pulls.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number | ||
}); | ||
const { data: files } = await github.rest.pulls.listFiles({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number | ||
}); | ||
const modifiedLanguages = new Set(files.map(file => file.filename.split('/')[0])); | ||
const labelsToAdd = languages.filter(lang => !modifiedLanguages.has(lang)).map(lang => `requires-translation-${lang}`); | ||
await github.rest.issues.addLabels({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: pullRequest.number, | ||
labels: labelsToAdd | ||
}); |