Skip to content

Commit

Permalink
Create auto-label.yml
Browse files Browse the repository at this point in the history
Tag issues with high, medium and low
  • Loading branch information
domalab authored Dec 7, 2024
1 parent 8a35759 commit 6cb55ef
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Auto Label Issues
on:
issues:
types: [opened, edited]

jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: Label Issues Based on Content
uses: actions/github-script@v6
with:
script: |
const labelsToAdd = [];
const issueBody = context.payload.issue.body;
// Check for priority in the issue body
if (issueBody.includes("High")) {
labelsToAdd.push("priority-high");
} else if (issueBody.includes("Medium")) {
labelsToAdd.push("priority-medium");
} else if (issueBody.includes("Low")) {
labelsToAdd.push("priority-low");
}
// Apply the labels
if (labelsToAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: labelsToAdd,
});
}

0 comments on commit 6cb55ef

Please sign in to comment.