Creating a gh CLI extension for creating GitHub Discussions via category forms

Featured image for sharing metadata for article

As part of getting ready for my new job at Mend this week, working on Renovate, I've been thinking a little bit about my workflow.

One of the choices the Renovate maintainers made a couple of years ago was that Q&A/feature requests should come through the GitHub Discussions on the project, then will be "promoted" into an Issue that then will get addressed after a level of triage.

I'm a big fan of this, as well as the fact that the project is using Discussion category forms to provide a structured set of inputs for reports from users, which guides them through the information needed.

This is something I'd fairly recently taken onboard to streamline some internal processes at Elastic using these Discussion category forms, and found them to be very beneficial.

However, one thing I've found is that they only work in the GitHub UI, and there's no way to create a Discussion via the GitHub CLI.

(There's more discussion (heh) about adding Discussions into the GitHub CLI here and here, which so far is a "no" from GitHub)

As I'll be starting to work with Discussions a lot more - creating them to propose new features, report bugs, or announce changes - I wanted to have a slightly easier way to interact with the Discussions functionality using my trusty CLI tooling, rather than needing to use the UI.

With this in mind, I've created an extension for the CLI called jamietanna/gh-discussion which has the ability to create a new Discussion using a given category form in the repository.

Thanks to GitHub Copilot for a little bit of help, I've now got gh discussion create for all my needs πŸš€

Want to give it a spin? Try it out with my testing repository like so:

gh extension install jamietanna/gh-discussion
gh discussion create --repo jamietanna/gh-discussion-testing

And for those who want to see it without locally running it:

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #github.

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.