--- name: git-issue-labeler description: Assess GitHub issues and assign appropriate labels using GitHub default labels (bug, enhancement, documentation, duplicate, good first issue, help wanted, invalid, question, wontfix) with detailed descriptions license: Apache-2.0 compatibility: opencode metadata: audience: developers, maintainers workflow: issue-management --- ## What I do I provide intelligent GitHub issue label assessment by: - Analyzing issue content to determine appropriate GitHub default labels - Using keyword and pattern matching to identify issue types - Assigning single or multiple labels based on issue complexity - Providing label descriptions for clarity and consistency - Supporting the 9 GitHub default labels: bug, enhancement, documentation, duplicate, good first issue, help wanted, invalid, question, wontfix - Using GitHub CLI (`gh`) to query available repository labels - Generating label assignment reports for review ## When to use me Use this when: - You need to assess and label GitHub issues automatically - You want consistent label assignment across your repository - You need to categorize issues using GitHub's default label scheme - You're setting up a new repository and need label guidelines - You want to review unlabeled or mislabeled issues - You need to train contributors on when to use specific labels ## Prerequisites - GitHub CLI (`gh`) installed and authenticated - Git repository with GitHub remote - Write access to the GitHub repository - Repository uses GitHub's default labels or custom labels - Valid `GITHUB_TOKEN` or `gh` authentication setup ## GitHub Default Labels Reference ### bug **Description**: Something isn't working as expected or is broken **Keywords**: fix, error, broken, crash, fail, doesn't work, incorrect, wrong, problem, issue, bug, defect **Examples**: - "Login fails when user enters invalid credentials" - "App crashes when uploading large files" - "Button click doesn't trigger expected action" ### enhancement **Description**: New feature or request to improve existing functionality **Keywords**: add, implement, create, new, feature, support, introduce, build, develop, request, suggestion **Examples**: - "Add dark mode support to the dashboard" - "Implement export to PDF functionality" - "Add pagination to user list" ### documentation **Description**: Improvements or additions to documentation **Keywords**: document, readme, docs, guide, explain, tutorial, wiki, comment, manual, help **Examples**: - "Document the API endpoints for authentication" - "Update README with installation instructions" - "Add code comments to complex functions" ### duplicate **Description**: This issue or pull request already exists **Keywords**: duplicate, same as, already exists, similar, repeated, already reported **Examples**: - "This is the same as issue #123" - "Already reported in #456" ### good first issue **Description**: Good for newcomers or first-time contributors **Keywords**: beginner, simple, easy, small, straightforward, first time, newcomer, junior **Examples**: - "Fix typo in header component" - "Add unit test for utility function" - "Update example in README" ### help wanted **Description**: Extra attention or help is needed **Keywords**: help wanted, need help, assistance, looking for help, collaboration, community **Examples**: - "Need help with performance optimization" - "Looking for someone to review documentation" ### invalid **Description**: This doesn't seem right or is not a valid issue **Keywords**: invalid, not an issue, wrong repo, user error, configuration, misunderstanding **Examples**: - "This is a user configuration issue" - "Wrong repository for this feature request" - "Not a bug - working as designed" ### question **Description**: Further information is requested or clarification needed **Keywords**: question, how, what, why, clarification, explain, understand, ask, wondering **Examples**: - "How do I configure authentication?" - "What is the purpose of this function?" - "Question about API usage" ### wontfix **Description**: This will not be worked on due to technical limitations, out of scope, or other reasons **Keywords**: wontfix, out of scope, not feasible, declined, rejected, wont do, never **Examples**: - "Feature is out of scope for this project" - "Technical limitations prevent implementation" - "Not aligned with project goals" ## Steps ### Step 1: Query Available Labels First, check what labels are available in the repository: ```bash # Get all available labels in the repository gh label list --json name,description,color # Get default labels specifically gh label list --search "bug|enhancement|documentation|duplicate|good first issue|help wanted|invalid|question|wontfix" ``` ### Step 2: Analyze Issue Content Read the issue title and body to identify keywords and patterns: ```bash # Read issue content gh issue view --json title,body,labels # Extract title and body for analysis issue_title=$(gh issue view --jq '.title') issue_body=$(gh issue view --jq '.body') ``` ### Step 3: Determine Appropriate Labels Use keyword matching to assign labels: #### Label Detection Logic **Bug Detection**: ```bash if [[ "$issue_content" =~ (fix|error|broken|crash|fail|doesn't work|incorrect|wrong|problem|bug|defect) ]]; then labels+=("bug") fi ``` **Enhancement Detection**: ```bash if [[ "$issue_content" =~ (add|implement|create|new|feature|support|introduce|build|develop|request|suggestion) ]]; then labels+=("enhancement") fi ``` **Documentation Detection**: ```bash if [[ "$issue_content" =~ (document|readme|docs|guide|explain|tutorial|wiki|comment|manual|help) ]]; then labels+=("documentation") fi ``` **Duplicate Detection**: ```bash if [[ "$issue_content" =~ (duplicate|same as|already exists|similar|repeated|already reported) ]]; then labels+=("duplicate") fi ``` **Good First Issue Detection**: ```bash if [[ "$issue_content" =~ (beginner|simple|easy|small|straightforward|first time|newcomer|junior) ]]; then labels+=("good first issue") fi ``` **Help Wanted Detection**: ```bash if [[ "$issue_content" =~ (help wanted|need help|assistance|looking for help|collaboration|community) ]]; then labels+=("help wanted") fi ``` **Invalid Detection**: ```bash if [[ "$issue_content" =~ (invalid|not an issue|wrong repo|user error|configuration|misunderstanding) ]]; then labels+=("invalid") fi ``` **Question Detection**: ```bash if [[ "$issue_content" =~ (question|how|what|why|clarification|explain|understand|ask|wondering) ]]; then labels+=("question") fi ``` **Wontfix Detection**: ```bash if [[ "$issue_content" =~ (wontfix|out of scope|not feasible|declined|rejected|wont do|never) ]]; then labels+=("wontfix") fi ``` ### Step 4: Assign Labels to Issue Use GitHub CLI to assign the determined labels: ```bash # Assign single label gh issue edit --add-label "bug" # Assign multiple labels gh issue edit --add-label "bug,enhancement" # Remove incorrect labels gh issue edit --remove-label "documentation" ``` ### Step 5: Generate Assessment Report Create a summary of the label assignment: ```markdown # Issue Label Assessment **Issue**: # - **Assigned Labels**: - ``: