Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@
)$
types: [yaml]

# this hook is autogenerated from a script
# to modify this hook, update `src/check_jsonschema/catalog.py`
# and run `make generate-hooks` or `tox run -e generate-hooks-config`
- id: check-github-issue-config
name: Validate GitHub issue config
description: 'Validate GitHub issue config against the schema provided by SchemaStore'
entry: check-jsonschema --builtin-schema vendor.github-issue-config
language: python
files: >
(?x)^(
^\.github/ISSUE_TEMPLATE/config\.yml$
)$
types: [yaml]

# this hook is autogenerated from a script
# to modify this hook, update `src/check_jsonschema/catalog.py`
# and run `make generate-hooks` or `tox run -e generate-hooks-config`
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Unreleased

.. vendor-insert-here

- Add GitHub issue config schema and pre-commit hook (:issue:`589`).
- Add GitHub issue form schema and pre-commit hook (:issue:`588`).

0.33.3
Expand Down
14 changes: 14 additions & 0 deletions docs/precommit_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,20 @@ Validate GitHub Actions against the schema provided by SchemaStore
- id: check-github-actions


``check-github-issue-config``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Validate GitHub issue config against the schema provided by SchemaStore

.. code-block:: yaml
:caption: example config

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.3
hooks:
- id: check-github-issue-config


``check-github-issue-forms``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ SchemaStore and other sources:
- ``vendor.dependabot``
- ``vendor.drone-ci``
- ``vendor.github-actions``
- ``vendor.github-issue-config``
- ``vendor.github-issue-forms``
- ``vendor.github-workflows``
- ``vendor.gitlab-ci``
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://json.schemastore.org/github-issue-config.json",
"$comment": "https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser",
"properties": {
"blank_issues_enabled": {
"description": "Specify whether allow blank issue creation\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser",
"type": "boolean"
},
"contact_links": {
"title": "contact links",
"description": "Contact links\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser",
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": ["name", "url", "about"],
"properties": {
"name": {
"description": "A link title\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser",
"type": "string",
"minLength": 1,
"examples": ["Sample name"]
},
"url": {
"description": "A link URL\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser",
"type": "string",
"pattern": "^https?://",
"examples": ["https://sample/url"]
},
"about": {
"description": "A link description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser",
"type": "string",
"minLength": 1,
"examples": ["Sample description"]
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false,
"title": "GitHub issue template chooser config file schema",
"type": "object"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
899e718f4b8c965413b07ec63d8f089792a10c42409270db560b9a7ec0224a5a
10 changes: 10 additions & 0 deletions src/check_jsonschema/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ def _githubusercontent_url(owner: str, repo: str, ref: str, path: str) -> str:
"types": "yaml",
},
},
"github-issue-config": {
"url": "https://www.schemastore.org/github-issue-config.json",
"hook_config": {
"name": "Validate GitHub issue config",
"files": [
r"^\.github/ISSUE_TEMPLATE/config\.yml$",
],
"types": "yaml",
},
},
"github-issue-forms": {
"url": "https://www.schemastore.org/github-issue-forms.json",
"hook_config": {
Expand Down
7 changes: 7 additions & 0 deletions tests/acceptance/test_hook_file_matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ def get_hook_config(hookid):
),
"bad": (".github/actions/foo/other.yaml",),
},
"check-github-issue-config": {
"good": (".github/ISSUE_TEMPLATE/config.yml",),
"bad": (
".github/ISSUE_TEMPLATE/config.yaml",
".github/ISSUE_TEMPLATE/bug.yml",
),
},
"check-github-issue-forms": {
"good": (
".github/ISSUE_TEMPLATE/feature.yaml",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Questions & Discussions
url: https://github.com/Flexget/Flexget/discussions
about: Use GitHub discussions for message-board style questions and discussions
- name: Report an issue with Web UI
url: https://github.com/Flexget/webui/issues/new/choose
about: Please report issues for our Web UI in the Flexget/webui repository
Loading