Skip to content

Commit b8a98db

Browse files
committed
fix: labeler yml syntax, add labeler refining step
1 parent 18fd8d5 commit b8a98db

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.github/labeler.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@
2929
"translation 🌍":
3030
- public/content/translations/**/*
3131
- src/intl/**/*
32-
- !src/intl/en/**
3332

3433
"content 🖋️":
3534
- src/intl/en/**
3635
- public/content/**/*
37-
- !public/content/translations/**/*
3836

3937
"event 📅":
4038
- src/data/community-events.json

.github/workflows/label.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,26 @@ jobs:
1111
- uses: actions/labeler@v2
1212
with:
1313
repo-token: "${{ secrets.GITHUB_TOKEN }}"
14+
15+
- name: Refine labels
16+
uses: actions/github-script@v5
17+
with:
18+
github-token: ${{ secrets.GITHUB_TOKEN }}
19+
script: |
20+
try {
21+
const { owner, repo, number: pull_number } = context.issue;
22+
const { data: files } = await github.pulls.listFiles({ owner, repo, pull_number });
23+
24+
const allInEn = files.every(file => file.filename.startsWith('src/intl/en/'));
25+
const allInTranslations = files.every(file => file.filename.startsWith('public/content/translations/'));
26+
27+
if (allInEn) {
28+
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'translation 🌍' });
29+
}
30+
31+
if (allInTranslations) {
32+
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'content 🖋️' });
33+
}
34+
} catch (error) {
35+
console.warn("Problem occurred refining labels")
36+
}

0 commit comments

Comments
 (0)