-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Auto-Labeling for Issues using GitHub Actions #5136
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Vineet1101 <Vineetgoel692@gmail.com>
I, Vineet1101 <Vineetgoel692@gmail.com>, hereby add my Signed-off-by to this commit: 796accb Signed-off-by: Vineet1101 <Vineetgoel692@gmail.com>
@fruffy @jafingerhut please review this pr |
.github/workflows/auto-label.yml
Outdated
|
||
// Define keyword-label mapping | ||
const labelMappings = { | ||
"bug": "bug", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use brackets here, eg [frontend]. Is this case insensitive? Also do not use the body. The title is good enough. Otherwise you will get many, many false positives with this approach.
Also, only use labels that make sense. For example, why would someone tag their issue [duplicate]
or [question]
?
There are some other ones which are useful.
[P4Testgen] -> p4tools tag.
[P4Smith] -> p4tools tag.
[P4tools] -> p4tools tag.
In general, try to take a look at how the labels are currently used for issues and try to reflect this mapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fruffy I don't get what exactly you mean by [frontend] like the actions should check for [bug] in the title instead of bug??
Yes it is case sensitive but I have updated the code so now it is case insensitive and I have also included more labels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, this PR uses frontend and the label is core.
#5133
Because the frontend, midend, parser, etc are all part of the compiler core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so if we apply [frontend] like this I think it will not work properly as many people will not mention [] while writing the title for their issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we can use frontend or front end in the title, but we have to be careful about false positives. [Frontend] is rather safe.
Another example is this issue:
This issue can be tagged tofino and bug because it has a compiler bug label and tofino in the title.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we apply regex to match exactly from the tittle. For false positive maybe we can use a priority list so that the one's with higher priority gets label and one more thing I would like to ask is I don't get your point with [Frontend] I mean while writing the title of a issue people will simple write frontend they will not enclose it in brackets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more solution that I can think is using weighted keyword matching
const labelMappings = { "compiler-core": { keywords: ["frontend", "midend", "parser", "backend"], threshold: 1 }, "networking": { keywords: ["dpdk", "ebpf", "switching"], threshold: 1 }, };
in this if threshold crosses 1 the compiler-core will get applied if not then parser or whatever written in the title will get applied. We can apply strict checking using regex to avoid false positive.
What are your thoughts on this idea @fruffy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mean while writing the title of a issue people will simple write frontend they will not enclose it in brackets.
A lot of developers actually do this. Especially once a keyword will automatically lead to labelling.
What are your thoughts on this idea @fruffy
Multiple labels are actually ok. I would take a look at the current labels we have and then decide how these should be assigned. Feel also free to ask on what these labels mean.
This could also be part of documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok for now I will add brackets also and once you have checked and decided tell me I will make changes according to that. I think we should also mention somewhere this thing in docs or something that one should use [] to auto add labels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's do that!
Signed-off-by: Vineet1101 <Vineetgoel692@gmail.com>
"[p4c]": "p4c", | ||
"[bmv2]": "bmv2", | ||
"[compiler]": "compiler", | ||
"[test]": "testing", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a label.
"[feature]": "enhancement", | ||
"[docs]": "documentation", | ||
"[dpdk]": "dpdk", | ||
"[p4c]": "p4c", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also not an existing label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed that non existing labels
"[bug]": "bug", | ||
"[error]": "bug", | ||
"[fix]": "bug", | ||
"[feature]": "enhancement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also be feat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean in addition to [feature] we should also add [feat] and both will map to enhancement??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, yes. You could have multiple variants.
"[Tofino]":"tofino", | ||
"[p4tc]": "p4tc", | ||
"[p4fmt]": "p4fmt", | ||
"[core]":"core", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This list is missing some more labels:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fruffy can you please clear this doubts so that I can make changes accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am currently traveling with limited access to internet. I will give this a thorough look later. run-xyz
you do not need to map.
For the other labels you should take a look at the issues that are being tagged with them and see whether you can find a mapping that works.
@fruffy any suggestions you would like to give
|
This pr is to add automation in adding labels to issue in the p4c repo. I have used github actions to implement this
Here's a demo video
Screencast.from.2025-02-20.10-31-12.mp4