From 57799ec5944179094b40b54dd8af33477d752131 Mon Sep 17 00:00:00 2001 From: IamLizu Date: Fri, 2 Aug 2024 21:39:49 +0600 Subject: [PATCH] call `addLabels` only when `labelsToAdd` is not empty --- .github/workflows/translation.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index 2309027350..34ba964fc0 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -57,9 +57,11 @@ jobs: }); 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 - }); \ No newline at end of file + if (labelsToAdd.length > 0) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pullRequest.number, + labels: labelsToAdd + }); + } \ No newline at end of file