DEV Community

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

Posted on • Edited on

7 1

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.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay