Skip to content

Commit

Permalink
feat: add translations pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
UlisesGascon committed May 11, 2024
1 parent 484ddb8 commit 54ecaa9
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/translation.yml
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
});

0 comments on commit 54ecaa9

Please sign in to comment.