Repository navigation
Conversation
|
@stianst - this is a suggestion on how to approach this. It does not yet set the GitHub issue type, just the label. Pleaes let me know if you agree with the approach, and if it needs refinement. |
|
For some reason I was sure that GH CLI supported issue templates, but it doesn't (well barely does). So, you are correct on this one. I propose we make it explicit in the templates what issue type it is for so we can identify all issue templates: This might be taking it one step to far, but maybe we should also validate new issues match a template, and provides all the required fields? If it doesn't we auto-close. |
3d2ae77 to
3d38751
Compare
|
@stianst - the issues we receive are usually quite good, so wouldn't auto-close them. I assume we'll soon have a bot that identifies the type and area when the simple pattern doesn't suffice. I tested this against my repository, and it should be good for merging. Evidence linked in the body. |
There was a problem hiding this comment.
🟡 Changes recommended
Substring matching in IssueParser misclassifies bug-heading text in prose or code, causing incorrect labels; heading-aware detection and regression tests are needed.
1 open issue
What changed in this PR
This PR addresses #84 by deriving labels from issue-template bodies, allowing API- and CLI-created issues without kind labels to enter the bot’s triage workflow.
Changes:
- Detects current template types and legacy bug/enhancement templates.
- Applies kind and triage labels as appropriate, retaining area labeling for bugs.
- Adds parser and handler tests with template and plain-body fixtures.
| File | Description |
|---|---|
src/main/java/org/keycloak/gh/bot/AddAreaLabelToBugs.java |
Applies labels based on detected template type. |
src/main/java/org/keycloak/gh/bot/utils/IssueParser.java |
Detects current and legacy template structures. |
src/main/java/org/keycloak/gh/bot/utils/Labels.java |
Adds kind constants and prefix matching. |
src/test/java/org/keycloak/gh/bot/AddAreaLabelToBugsTest.java |
Tests label application and existing-kind handling. |
src/test/java/org/keycloak/gh/bot/utils/IssueParserTest.java |
Tests template detection and unmatched bodies. |
src/test/resources/org/keycloak/gh/bot/utils/issue-body-bug-v2 |
Current bug-template fixture. |
src/test/resources/org/keycloak/gh/bot/utils/issue-body-enhancement |
Legacy enhancement-template fixture. |
src/test/resources/org/keycloak/gh/bot/utils/issue-body-enhancement-v2 |
Current enhancement-template fixture. |
src/test/resources/org/keycloak/gh/bot/utils/issue-body-feature-v2 |
Current feature-template fixture. |
src/test/resources/org/keycloak/gh/bot/utils/issue-body-plain |
Non-template fixture. |
src/test/resources/org/keycloak/gh/bot/utils/issue-body-task-v2 |
Current task-template fixture. |
Review effort: Balanced
Closes keycloak#84 Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
3d38751 to
e030191
Compare

Closes #84
Issues created via the GitHub API or
gh --templatecarry no labels, so triage never starts. The bot now derives the labels from the template structure in the issue body.Decisions and assumptions:
IssueParser.detectTemplateType(): the ones before Make it possible to identify the issue template used when labels are not added keycloak#55144 and the ones after, which have a distinct description header per type.kind/enhancement. The triager can change this to a feature.kind/bug,status/triageand thearea/label; enhancements and features get theirkind/label andstatus/triage; tasks getkind/taskonly, as in the template.kind/label are left untouched, as are issues that match no template.Tested with a test GitHub App on a fork with the upstream templates and labels. Issues created via the API without labels were labeled as expected: