DEV Community

Cover image for Programmatically Add Labels to Your Issues
Rizèl Scarlett for GitHub

Posted on • Updated on

 

Programmatically Add Labels to Your Issues

For the past week, I’ve been working on building a Probot app that automates inviting users to my GitHub organization. If you read my past blog post, you will learn that I decided to implement a form of triaging by opening an issue for potential members if they star the repository. That was successful, but I realized that other people may open issues in my repository for various reasons – not just to join my organization. I don’t want to weed through multiple issues to figure out if they are requests or not. I prefer to filter for the ones that are requests. An easy way to do that is by adding a label to the issues that include requests to join my organization.

To programmatically add a label to my issues, I added a labels property. The labels property accepts an array of strings representing label names. I used the label ‘pending-invitation’.

Image description

Now, I can filter the issues by the pending-invitation label.

Image description

Image description

Tomorrow, I plan to approve pending issues and them to the organization. Stay tuned, and follow GitHub and me on DEV for more content.

Top comments (0)

18 Useful Github Repositories Every Developer Should Bookmark

18 Useful GitHub repositories every developer should bookmark: everything from learning resources and roadmaps to best practices, system designs, and tools.