Skip to content

Update migration guide #138

Update migration guide

Update migration guide #138

Workflow file for this run

name: Check Translation
on:
pull_request:
branches:
- gh-pages
paths:
- 'en/**'
- 'es/**'
- 'fr/**'
- 'it/**'
- 'id/**'
- 'ja/**'
- 'ko/**'
- 'pt-br/**'
- 'ru/**'
- 'sk/**'
- 'th/**'
- 'tr/**'
- 'uk/**'
- 'uz/**'
- 'zh-cn/**'
- 'zh-tw/**'
workflow_dispatch:
inputs:
prNumber:
description: 'PR number to check'
required: true
jobs:
check-translation:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
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', 'id', 'ja', 'ko', 'pt-br', 'ru', 'sk', 'th', 'tr', 'uk', 'uz', 'zh-cn', 'zh-tw'];
const prNumber = context.eventName === 'workflow_dispatch' ? context.payload.inputs.prNumber : context.issue.number;
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
const modifiedLanguages = new Set(files.map(file => file.filename.split('/')[0]));
const labelsToAdd = languages.filter(lang => !modifiedLanguages.has(lang)).map(lang => `requires-translation-${lang}`);
if (labelsToAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullRequest.number,
labels: labelsToAdd
});
}