Skip to content

Commit

Permalink
feat: added auto-assign lable
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyanthakur committed Oct 6, 2024
1 parent adcb84a commit 26c87b6
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'Auto Label Assignment'

on:
issues:
types: [opened]
pull_request:
types: [opened]

jobs:
assign-labels:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Assign always-required labels
run: |
# Always add these labels
echo "Adding always assigned labels: hacktoberfest, hacktoberfest-accepted, hactoberfest2024"
gh issue edit ${{ github.event.issue.number || github.event.pull_request.number }} --add-label "hacktoberfest"
gh issue edit ${{ github.event.issue.number || github.event.pull_request.number }} --add-label "hacktoberfest-accepted"
gh issue edit ${{ github.event.issue.number || github.event.pull_request.number }} --add-label "hactoberfest2024"
- name: Auto assign specific labels based on conditions
run: |
ISSUE_TITLE="${{ github.event.issue.title || github.event.pull_request.title }}"
# Conditional label assignment based on title
if [[ "${ISSUE_TITLE,,}" =~ "bug" ]]; then
echo "Adding label 'bug'"
gh issue edit ${{ github.event.issue.number || github.event.pull_request.number }} --add-label "bug"
elif [[ "${ISSUE_TITLE,,}" =~ "documentation" ]]; then
echo "Adding label 'documentation'"
gh issue edit ${{ github.event.issue.number || github.event.pull_request.number }} --add-label "documentation"
elif [[ "${ISSUE_TITLE,,}" =~ "enhancement" ]]; then
echo "Adding label 'enhancement'"
gh issue edit ${{ github.event.issue.number || github.event.pull_request.number }} --add-label "enhancement"
else
echo "No additional matching label found for this issue or PR."

0 comments on commit 26c87b6

Please sign in to comment.