Skip to content

Commit

Permalink
Add automated logic for tagging issues (#4866)
Browse files Browse the repository at this point in the history
* Create label-issues.yml

* Update label-issues.yml
  • Loading branch information
localden authored Aug 1, 2024
1 parent 5db1993 commit 5c9496d
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/label-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
});
}

0 comments on commit 5c9496d

Please sign in to comment.