alstr / todo-to-issue-action

Action that converts TODO comments to GitHub issues on push.
MIT License
605 stars 115 forks source link

Configure default labels in workflow file #66

Closed NBprojekt closed 2 years ago

NBprojekt commented 3 years ago

Would it be possible to configure the default labels using the workflow file?

In my case, I would like to add the automatic-todo and bot labels to every issue I have created without having to write multiline comments with the same content each time.


As far as I understand your code changing line 457 to the code bellow should do the trick for a single custom default label.

labels=[os.getenv('INPUT_LABEL', 'todo')],

Of course the README.md and action.yml needs to be adjusted too.

If you want I would create a PR for this feature.

alstr commented 3 years ago

I have thought about doing this and it would definitely be possible.

We do for now need to retain the todo label as that is what the action uses to find issues it has previously created.

A similar functionality currently exists with setting default projects, so it could work the same way:

https://github.com/alstr/todo-to-issue-action/blob/63126d70260dc962111eb9b2293b0606971b0ed5/main.py#L421

If no labels have been added to the TODO and a comma-separated list of LABELS is set in the workflow file, add these labels to the issue.

What do you think?

NBprojekt commented 3 years ago

We do for now need to retain the todo label as that is what the action uses to find issues it has previously created.

I understand now 🤔, why my issues never got updated, because I always changed the label manually from todo to automatic-todo.

Anyway, this sounds like a good approach.

But when I change the (todo) label that the action uses to identify previously created issues, to eg. todos for all issues, this should work fine right?
What do you think abount creating a parameter that like ISSUE_LABEL that takes a single label, on defaul todo and use this to identify previously created issues.

alstr commented 3 years ago

If you edit the action code to change the label it uses from todo to todos that would work. If you change the labels manually on the issues then that wouldn't work as you point out.

I think changing the todo label used by the action to identify issues would be fine. The only potential problem is if people create some issues with label todo, then change it to new, then the action would kind of forget about all of those created with the old label.

NBprojekt commented 3 years ago

I think changing the todo label used by the action to identify issues would be fine. The only potential problem is if people create some issues with label todo, then change it to new, then the action would kind of forget about all of those created with the old label.

I think the same goes for the fact that people could change the label of issues afterwards and the issue would no longer be accessible to action. It is something that you cannot control.

Therefore, In my opinion, it would be a great feature to configure the label used to identify issues because it can change anyway afterwards.

Maybe put some more passion into the documentation that people must know what they do before changing the value.



This are just my thought and i must thank you for your time.

alstr commented 2 years ago

I've just pushed a commit for this functionality. I've not created an actual release for it yet but will do soon.

Example usage (add to workflow.yml):

IDENTIFIERS: '[{"name": "TODO", "labels": ["help wanted"]}, {"name": "FIXME", "labels": ["bug"]}]'

Must be valid JSON with double quoted keys/values.

If you don't want to define default labels, you can just set labels to an empty list.

alstr commented 2 years ago

Now live in v4.7. 😄