Skip to content

Commit

Permalink
Merge pull request #3 from uk-tre/add-action
Browse files Browse the repository at this point in the history
Add action to check json format
  • Loading branch information
JimMadge authored Oct 3, 2023
2 parents 3ca9172 + 5eece21 commit 5f516e8
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 68 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Check JSON formatting

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Run pre-commit
uses: pre-commit/[email protected]
64 changes: 32 additions & 32 deletions schema.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"package_name": {"type": "string"},
"version": {
"type": "string",
"_comment": "PEP404 version string prefixed with a comparison operator, Excluding trailing '.*'.\nhttps://peps.python.org/pep-0440/#version-specifiers\nhttps://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions",
"pattern": "^(~=|==|!=|<=|>=|<|>|===)\\s*([1-9][0-9]*!)?(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\\.post(0|[1-9][0-9]*))?(\\.dev(0|[1-9][0-9]*))?$"
},
"approval_date": {
"type": "string",
"format": "date"
},
"revoke_date": {
"oneOf": [
{
"type": "string",
"format": "date"
},
{
"type": "null"
}
]
}
},
"required": ["package_name", "version", "approval_date", "revoke_date"],
"additionalProperties": false
}
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"package_name": { "type": "string" },
"version": {
"type": "string",
"_comment": "PEP404 version string prefixed with a comparison operator, Excluding trailing '.*'.\nhttps://peps.python.org/pep-0440/#version-specifiers\nhttps://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions",
"pattern": "^(~=|==|!=|<=|>=|<|>|===)\\s*([1-9][0-9]*!)?(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\\.post(0|[1-9][0-9]*))?(\\.dev(0|[1-9][0-9]*))?$"
},
"approval_date": {
"type": "string",
"format": "date"
},
"revoke_date": {
"oneOf": [
{
"type": "string",
"format": "date"
},
{
"type": "null"
}
]
}
},
"required": ["package_name", "version", "approval_date", "revoke_date"],
"additionalProperties": false
}
}
78 changes: 42 additions & 36 deletions schema_other.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"package_name": {"type": "string"},
"url": {
"type": "string",
"format": "uri"
},
"version": {
"type": "string",
"_comment": "PEP404 version string prefixed with a comparison operator, Excluding trailing '.*'.\nhttps://peps.python.org/pep-0440/#version-specifiers\nhttps://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions",
"pattern": "^(~=|==|!=|<=|>=|<|>|===)\\s*([1-9][0-9]*!)?(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\\.post(0|[1-9][0-9]*))?(\\.dev(0|[1-9][0-9]*))?$"
},
"approval_date": {
"type": "string",
"format": "date"
},
"revoke_date": {
"oneOf": [
{
"type": "string",
"format": "date"
},
{
"type": "null"
}
]
}
},
"required": ["package_name", "url", "version", "approval_date", "revoke_date"],
"additionalProperties": false
}
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"package_name": { "type": "string" },
"url": {
"type": "string",
"format": "uri"
},
"version": {
"type": "string",
"_comment": "PEP404 version string prefixed with a comparison operator, Excluding trailing '.*'.\nhttps://peps.python.org/pep-0440/#version-specifiers\nhttps://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions",
"pattern": "^(~=|==|!=|<=|>=|<|>|===)\\s*([1-9][0-9]*!)?(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\\.post(0|[1-9][0-9]*))?(\\.dev(0|[1-9][0-9]*))?$"
},
"approval_date": {
"type": "string",
"format": "date"
},
"revoke_date": {
"oneOf": [
{
"type": "string",
"format": "date"
},
{
"type": "null"
}
]
}
},
"required": [
"package_name",
"url",
"version",
"approval_date",
"revoke_date"
],
"additionalProperties": false
}
}

0 comments on commit 5f516e8

Please sign in to comment.