-
Notifications
You must be signed in to change notification settings - Fork 340
59 lines (49 loc) · 1.63 KB
/
label-issues.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Label Client Issues
on:
issues:
types: [opened, edited]
permissions:
issues: write
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check issue body for client type
id: check_label
uses: actions/github-script@v7
with:
script: |
const labelsToAdd = [];
const publicClientOptions = [
"PublicClient"
];
const confidentialClientOptions = [
"ConfidentialClient"
];
const managedIdentityClientOptions = [
"ManagedIdentityClient"
];
const issueBody = context.issue.body;
if (publicClientOptions.some(option => issueBody.includes(option))) {
labelsToAdd.push('public-client');
}
if (confidentialClientOptions.some(option => issueBody.includes(option))) {
labelsToAdd.push('confidential-client');
}
if (managedIdentityClientOptions.some(option => issueBody.includes(option))) {
labelsToAdd.push('scenario:ManagedIdentity');
}
return labelsToAdd;
- name: Add labels to the issue
uses: actions/github-script@v7
with:
script: |
const labels = ${{ steps.check_label.outputs.result }};
if (labels.length > 0) {
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labels
});
}