Closed xsebek closed 1 month ago
Hey, thanks for the suggestion. I think this is doable. The TODO already accepts a reference parameter, so if the issue number was supplied here, we could find the issue and add it as a comment.
Hi @alstr, I am not sure what you mean by adding the issue number as a comment.
Like would the TODO always create an Issue but link the issue as parent or dependency?
To me that would be a needless extra Issue. For example I could have already filed the Issue for an observed bug and added a TODO later once I have found the place that needs to be fixed.
The simple solution I imagined would be for the TODO pattern to not match on a TODO followed by Issue number.
From your original post I assumed that you were talking about having already created the issue, then wanting to later link code blocks to that issue, is that correct? So it wouldn't create a new issue, just add it to the existing one.
Oh, so like to make a comment authored by the person who provided the authentication token?
I guess that would work, though I am not sure how hard it would be for this action to learn how to do that. :confused:
Btw. I would like to match TODOs with this regex:
r'TODO\s*(\(([^()]*)\))?:(\s+#(\d+))?'
Group 2 is "reference" and group 4 is the Issue number.
It could be generalized to match on TODO(bug 12345):
or TODO: https://github.com/alstr/todo-to-issue-action/issues/123
, but I am not sure what is generally popular. :slightly_smiling_face:
Let's say there is an existing issue, say #123.
If we were to add a TODO like this:
# TODO(123) Refactor this code.
This would be added as a comment to that issue.
Is that what you're thinking?
Sorry for the late response, but yes, adding a comment with a permalink* to the TODO in code would be nice.
*) GitHub renders those quite nicely and it should be easier to create the link (url+commit+lines) than to format the TODO code snippet.
@alstr would you like to add this feature yourself, or should I try? :slightly_smiling_face:
Happy for you to have a go at it. It'll definitely get done quicker that way! I'll get around to it eventually if not. :smile:
This feature would be amazing, it would also prevent instances of issue duplication and simplify the complexity of that part of the code(I haven't looked but I assume preventing duplication is quite tricky atm)
@adriangalilea Yes, it can be as the action can be triggered multiple times depending on how it's set up. This is still something I want to look at though.
So I did add support for something similar to this, where specifying an issue ID would update that issue. However, I've since modified the action to insert issue URLs when issues are created, which it uses to manage existing issues. So I've ditched the original approach, and I'll see if I can support adding comments on existing issues instead.
That's awesome @alstr will give feedback when I get to try it, many thanks.
Hi, I wonder if TODOs with explicitly written issue numbers are supported?
For example, let's imagine I have an Issue 321: "Fix config loading" and then I want to have this TODO in some file:
I am not sure what the best behaviour for such TODO would be, ignoring them would be fine, maybe adding a comment to the Issue would be better, but also more work.
Maybe there already is some syntax for such functionality, but I did not find it. :slightly_smiling_face: