Skip to content
Closed
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 @@ -190,6 +190,20 @@
)$
types: [yaml]

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

# this hook is autogenerated from a script
# to modify this hook, update `src/check_jsonschema/catalog.py`
# and run `just 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 @@ -12,6 +12,7 @@ Unreleased

- Update vendored schemas: buildkite, circle-ci, citation-file-format, gitlab-ci,
meltano, mergify, renovate, snapcraft (2026-10-18)
- Add a ``check-github-funding`` pre-commit hook. (:issue:`725`)
- Added support for Python 3.15 .
- Removed support for Python 3.10 .
- The build backend has been updated from setuptools to flit.
Expand Down
14 changes: 14 additions & 0 deletions docs/precommit_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,20 @@ Validate GitHub discussion against the schema provided by SchemaStore
- id: check-github-discussion


``check-github-funding``
~~~~~~~~~~~~~~~~~~~~~~~~

Validate GitHub funding against the schema provided by SchemaStore

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

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.38.2
hooks:
- id: check-github-funding


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

Expand Down
1 change: 1 addition & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ SchemaStore and other sources:
- ``vendor.drone-ci``
- ``vendor.github-actions``
- ``vendor.github-discussion``
- ``vendor.github-funding``
- ``vendor.github-issue-config``
- ``vendor.github-issue-forms``
- ``vendor.github-workflows``
Expand Down
113 changes: 113 additions & 0 deletions src/check_jsonschema/builtin_schemas/vendor/github-funding.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://json.schemastore.org/github-funding.json",
"$comment": "https://docs.github.com/en/github/administering-a-repository/displaying-a-sponsor-button-in-your-repository",
"additionalProperties": false,
"description": "You can add a sponsor button in your repository to increase the visibility of funding options for your open source project.",
"properties": {
"community_bridge": {
"title": "LFX Mentorship (formerly CommunityBridge)",
"description": "Project name on CommunityBridge.",
"type": "string",
"minLength": 1
},
"github": {
"title": "GitHub Sponsors",
"description": "You can add one organization and up to four sponsored developers.",
"oneOf": [
{
"type": "string",
"minLength": 1
},
{
"type": "array",
"minItems": 1,
"maxItems": 5,
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1
}
}
]
},
"issuehunt": {
"title": "IssueHunt",
"description": "Username on IssueHunt.",
"type": "string",
"minLength": 1
},
"ko_fi": {
"title": "Ko-fi",
"description": "Username on Ko-fi.",
"type": "string",
"minLength": 1
},
"liberapay": {
"title": "Liberapay",
"description": "Username on Liberapay.",
"type": "string",
"minLength": 1
},
"open_collective": {
"title": "Open Collective",
"description": "Username on Open Collective.",
"type": "string",
"minLength": 1
},
"patreon": {
"title": "Patreon",
"description": "Username on Patreon.",
"type": "string",
"minLength": 1
},
"tidelift": {
"title": "Tidelift",
"description": "Platform and package on Tidelift, following the format `PLATFORM-NAME/PACKAGE-NAME`.",
"type": "string",
"pattern": "^(npm|pypi|rubygems|maven|packagist|nuget)/.+$"
},
"polar": {
"title": "Polar",
"description": "Username on Polar.",
"type": "string",
"minLength": 1
},
"buy_me_a_coffee": {
"title": "Buy Me a Coffee",
"description": "Username on Buy Me a Coffee.",
"type": "string",
"minLength": 1
},
"thanks_dev": {
"title": "thanks.dev",
"description": "Maintainer profile on thanks.dev",
"type": "string",
"pattern": "^u/gh/.+$"
},
"custom": {
"title": "Custom URL or URL's",
"description": "Link or links where funding is accepted on external locations.",
"oneOf": [
{
"type": "string",
"minLength": 1,
"format": "uri-reference"
},
{
"type": "array",
"minItems": 1,
"maxItems": 4,
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1,
"format": "uri-reference"
}
}
]
}
},
"title": "GitHub Funding",
"type": "object"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
90d83f41c25a0029653a7ba64080aa6f3973527eed533f18f5b932a425bc802b
10 changes: 10 additions & 0 deletions src/check_jsonschema/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ def _gitlab_raw_url(repo: str, file_path: str, ref: str) -> str:
"types": "yaml",
},
},
"github-funding": {
"url": "https://www.schemastore.org/github-funding.json",
"hook_config": {
"name": "Validate GitHub funding",
"files": [
r"^\.github/FUNDING\.ya?ml$",
],
"types": "yaml",
},
},
"github-issue-config": {
"url": "https://www.schemastore.org/github-issue-config.json",
"hook_config": {
Expand Down
12 changes: 12 additions & 0 deletions tests/acceptance/test_hook_file_matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ def get_hook_config(hookid):
".github/DISCUSSION_TEMPLATE/not-a-discussion.txt",
),
},
"check-github-funding": {
"good": (
".github/FUNDING.yml",
".github/FUNDING.yaml",
),
"bad": (
".github/funding.yml",
".github/funding.yaml",
"FUNDING.yml",
".github/FUNDING.txt",
),
},
"check-github-issue-config": {
"good": (".github/ISSUE_TEMPLATE/config.yml",),
"bad": (
Expand Down
2 changes: 2 additions & 0 deletions tests/example-files/hooks/negative/github-funding/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [octocat]
unknown_funding_platform: invalid
4 changes: 4 additions & 0 deletions tests/example-files/hooks/positive/github-funding/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github: [octocat]
patreon: octocat
ko_fi: octocat
custom: ["https://example.com/donate"]