Search code examples
githubtemplatesgithub-issues

Github issue template validation (required: true) not working


I am trying to create a Github issue template and I would like to validate fields as filled in before allowing the user to submit the issue.

I am using the validations filed but Gthub does not seem to register it...

    validations:
      required: true

My Issue template yml file:

name: Test template
description: Fill out the test template.
title: "[Test]: "
body:
  - type: markdown
    attributes:
      value: |
        ## Thank you for taking the time to fill out this test template
  - type: textarea
    id: description
    attributes:
      label: Describe your issue
      placeholder: Issue
    validations:
      required: true


Result:

enter image description here


Expectations:

  • The "describe your issue" field should be mandatory with a red asterisk
  • The "Submit new issue" button should be disabled when the field is empty

I am not sure what I am doing wrong. Any ideas?

Thanks


Solution

  • Because I just had the same problem, I am going to assume your repository is set to "private". To make the "required" field to work as intended, you must set your repository to "public".

    As per GitHub's documentation:

    Note: The required field key is only supported in public repositories. In private and internal repositories, all fields are optional.

    https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms