Skip to content

Commit 69b4434

Browse files
committed
Initial commit: add Mergify pre-commit hook and README
0 parents  commit 69b4434

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

.pre-commit-hooks.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
- id: validate-mergify-config
2+
name: Validate Mergify configuration
3+
description: Validate Mergify configuration files against the official schema
4+
entry: check-jsonschema --schemafile https://docs.mergify.com/mergify-configuration-schema.json
5+
language: python
6+
additional_dependencies:
7+
- check-jsonschema==0.33.3
8+
files: |
9+
(?x)
10+
^(
11+
\.mergify\.(yml|yaml)
12+
| \.mergify/config\.(yml|yaml)
13+
| \.github/mergify\.(yml|yaml)
14+
)$

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## Mergify pre-commit hook
2+
3+
Official pre-commit hooks for Mergify. Validate Mergify configuration files.
4+
5+
### Usage
6+
7+
Add the following to your `.pre-commit-config.yaml`:
8+
9+
```yaml
10+
repos:
11+
- repo: https://github.com/Mergifyio/mergify-pre-commit
12+
rev: 1.0.0
13+
hooks:
14+
- id: validate-mergify-config
15+
```
16+
17+
It uses `check-jsonschema` under the hood with Mergify's official schema:
18+
19+
```
20+
https://docs.mergify.com/mergify-configuration-schema.json
21+
```
22+
23+
### Customization
24+
25+
- To pass extra arguments to `check-jsonschema`, use `args` in your config. For example, to enable strict mode:
26+
27+
```yaml
28+
repos:
29+
- repo: https://github.com/Mergifyio/mergify-pre-commit
30+
rev: 1.0.0
31+
hooks:
32+
- id: validate-mergify-config
33+
args: ["--strict"]
34+
```

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[build-system]
2+
requires = ["setuptools>=61"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "mergify-pre-commit"
7+
version = "1.0.0"
8+
description = "Official pre-commit hooks for Mergify (validate Mergify config)."
9+
readme = "README.md"
10+
requires-python = ">=3.8"
11+
authors = [
12+
{ name = "Mergify", email = "[email protected]" }
13+
]
14+
keywords = ["pre-commit", "mergify", "check-jsonschema", "schema"]
15+
16+
[project.urls]
17+
Homepage = "https://github.com/Mergifyio/mergify-pre-commit"
18+
Repository = "https://github.com/Mergifyio/mergify-pre-commit"
19+
Issues = "https://github.com/Mergifyio/mergify-pre-commit/issues"

0 commit comments

Comments
 (0)