-
Notifications
You must be signed in to change notification settings - Fork 4.8k
36 lines (29 loc) · 1.2 KB
/
label.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Labeler
on:
- pull_request_target
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Refine labels
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
const { owner, repo, number: pull_number } = context.issue;
const { data: files } = await github.pulls.listFiles({ owner, repo, pull_number });
const allInEn = files.every(file => file.filename.startsWith('src/intl/en/'));
const allInTranslations = files.every(file => file.filename.startsWith('public/content/translations/'));
if (allInEn) {
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'translation 🌍' });
}
if (allInTranslations) {
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'content 🖋️' });
}
} catch (error) {
console.warn("Problem occurred refining labels")
}