Skip to content

Commit

Permalink
feat: add support for existing PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
UlisesGascon committed May 9, 2024
1 parent 14d2266 commit 4f2d3ef
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ on:
- 'uz/**'
- 'zh-cn/**'
- 'zh-tw/**'
workflow_dispatch:
inputs:
prNumber:
description: 'PR number to check'
required: true

jobs:
check-translation:
Expand All @@ -33,15 +38,16 @@ jobs:
with:
script: |
const languages = ['en', 'es', 'fr', 'it', '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: context.issue.number
pull_number: prNumber
});
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
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}`);
Expand Down

0 comments on commit 4f2d3ef

Please sign in to comment.