Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 5

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.

4 Replies
Community Manager
Message 2 of 5

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

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!

Copilot Lvl 3
Message 3 of 5

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

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?

Community Manager
Message 4 of 5

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

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

Copilot Lvl 3
Message 5 of 5

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

Thanks. I subscribed to the beta.