How to write a bot/script for newly created issues?

Hello, for my project I would like to write a script (possibly in Python) which, once a new issue is submitted, I want to add certain labels based on the title content. E.g. if the title includes the word “windows” I want to add a “windows” label when the issue is created. Is there any way to do this?

Thanks in advance.

I don’t write in Python, but the general process for something like this is you would need to set up a server that accepts a webhook notification of new issues. Then, you would use the information in the webhook payload to determine if your server would take some sort of action. If it were to take some action, it would use the GitHub API (either REST v3 or GraphQL v4) to do that. For your example of adding a label, the REST v3 API for adding a label to an issue would be used.

Unfortunately, the specifics of building a server process and getting it hosted somewhere is out of scope for this board. But if you’re open to using Node, you could look at using the tools that Probot provides to make some of this more simple.

I hope that helps!

Thanks for your reply. And yeah, that’s what I thought. Setting up a server just for this it’s a bit too much though. Do you know if there are plans to integrate something like this into github one day?

As a matter of fact, there is. It’s called GitHub Actions and it is currently in limited beta.

1 Like

Thanks. I subscribed to the beta.