-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tag issues with high, medium and low
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); | ||
} |