Quick actions

cmd+k|ctrl+k

Navigation

Languages

Triage issue

Snippet info

Language

Python

Visibility

public

Author

hospino11

Created

2026-07-09T20:28:00.476981Z

Updated

2026-07-09T20:28:00.476981Z

def triage_issue(title, labels):
    if len(labels) == 0:
        
        
        if "error" in title.lower() or "bug" in title.lower():
            labels.append("bug")
            labels.append("needs triage")
        if "feature" in title.lower() or "add" in title.lower():
            labels.append("enhancement")
            labels.append("discussing")

    else:
        needsTriageIndex = next((idx for idx, s in enumerate(labels) if "needs triage" in s.lower()), -1)
        if needsTriageIndex > -1:
            del labels[needsTriageIndex]
    
            if "simple" in title.lower() or "easy" in title.lower():
                labels.append("good first issue")
            else:
                labels.append("help wanted")

        discussingIndex = next((idx for idx, s in enumerate(labels) if "discussing" in s.lower()), -1)
        if discussingIndex > -1:
            del labels[discussingIndex]
            if "planned" in title.lower() or "next" in title.lower():
                labels.append("on the roadmap")
            else:
                labels.appemd("help wanted")

    if "security" in title.lower():
        labels.append("critical")

    return labels
 
title = "app crashes with error"
labels = []
result = triage_issue(title, labels)
print(f"Issue triage result for '{title}' and labels {labels}")
INFO