Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

GitHub Form Templates

Posted on Oct 17 • Originally published at leonardomontini.dev When you, as a contributor, want to create a new issue on Github, you're presented with a blank page and a text area to write your issue description.If it's a feature request, you'd like to add all the relevant details and reasons why you think it's a good idea, to increase the chances of it being approved.Speaking of nasty bugs, what you write in the issue body should hopefully be enough to let the maintainers understand what's going on and how to fix it and prevent similar issues in the future.Everyone has their own way of writing issues and going in depth with details, which is great, but often times it's not the most efficient way.In this 2 chapters series, we'll see how to use GitHub Issue Templates to help contributors write better issues.You can find the full content in this video, or you can keep reading for Chapter 2.The direct evolution of the markdown template is indeed the form schema. In short, it's a yaml file that describes the form fields and their properties.The form what?Yes, instead of letting the user create an issue on a blank page, or in the best case scenario, on a large text area prefilled with some text and comments, you can create an actual form like this one:What can we see here? There are many types of fields, like text, dropdowns and checkboxes, and each of them can have a label and description.Some fields are required while some are optional and there are also some text separators to group fields together.Similarly to the markdown template I've talked about in the previous article, form templates are also stored in the .github/ISSUE_TEMPLATE folder of your repository, but instead of creating a markdown file, you need to create a yaml file.Before defining the form, you can set up some extra fields to define your template, that are, for example:This setup lets you define the name and description that will be shown in the template selection page, the labels and assignees that will be automatically added to the issue and the title that will be prefilled in the issue title Field, which is usually a prefix like [BUG] or [FEATURE].Right after this block, on the same file, you can start defining the fields of the form inside the body key, like this:You can find the full reference in the official docs.Sometimes when a user is going to create an issue, you actually want them first to read some documentation or directly redirect them to a more appropriate place, for example a discord server or stackoverflow for asking questions.The external links feature lets you do exactly that, by adding a list of links to the template.In this case, right below Bug Report and New Feature I linked Discord for generic questions and the CONTRIBUTING.md file on my repository where there's a specific section addressing the most common issue that is setting up the login on local development.Not really a surprise (thanks for the consistency GitHub), external links are also stored in the .github/ISSUE_TEMPLATE folder of your repository, this time in a specific file called config.yml.The content to render what you can see in the image above is:As you can see here, all links are an array under the contact_links key, and each link has a name, url and about field.You can also notice that I set blank_issues_enabled to true, which means that the user can still create a blank issue, without using any template. This isn't a security block but only enables a text right below the templates block saying "Don’t see your issue here? Open a blank issue."In any case, nothing stops the user from creating a blank issue by manually going on https://github.com/[Account]/[Repo]/issues/new even if there are templates.In this article we've seen how to use GitHub Issue Form Templates to help contributors write better issues and this closes this short two-chapter series about on GitHub Issues.Did you know that you can also create issues directly from Visual Studio Code? I talk about that in this article: Thanks for reading this article, I hope you found it interesting!I recently launched my Discord server to talk about Open Source and Web Development, feel free to join: https://discord.gg/bqwyEa6We6Do you like my content? You might consider subscribing to my YouTube channel! It means a lot to me ❤️You can find it here:Feel free to follow me to get notified when new articles are out ;)Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Sloan the DEV Moderator - Oct 15 Shingai Zivuku - Sep 26 Ronak Munjapara - Sep 27 Sanskriti Harmukh - Oct 5 Read our welcome letter which is an open invitation for you to join. Once suspended, this-is-learning will not be able to comment or publish posts until their suspension is removed. Once unsuspended, this-is-learning will be able to comment and publish posts again. Once unpublished, all posts by this-is-learning will become hidden and only accessible to themselves. If this-is-learning is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to Leonardo Montini. They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag this-is-learning: this-is-learning consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging this-is-learning will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

GitHub Form Templates

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×