Skip to content

Commit

Permalink
Create auto-label-issues.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
guruashish-dev authored Jan 18, 2025
1 parent bb8b4fc commit 00edec4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/auto-label-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Auto Label Issues Based on Title

on:
issues:
types: [opened, edited]

jobs:
label-issues:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Auto-label issues based on title
run: |
ISSUE_TITLE=$(jq -r .issue.title "$GITHUB_EVENT_PATH" | tr '[:upper:]' '[:lower:]')
if [[ "$ISSUE_TITLE" == *"bug"* ]]; then
LABELS="bug"
elif [[ "$ISSUE_TITLE" == *"enhancement"* ]]; then
LABELS="enhancement"
elif [[ "$ISSUE_TITLE" == *"documentation"* ]]; then
LABELS="documentation"
else
LABELS="help wanted"
fi
curl -X POST \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"labels\":[\"$LABELS\"]}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.issue.number }}/labels"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 00edec4

Please sign in to comment.