initial
This commit is contained in:
24
.gitea/workflows/cd.yaml
Normal file
24
.gitea/workflows/cd.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
name: CD
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Increment tag
|
||||||
|
id: increment-tag
|
||||||
|
uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@0.1.1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
- name: Push tag
|
||||||
|
run: |
|
||||||
|
git tag ${{ steps.increment-tag.outputs.new-tag }}
|
||||||
|
git push origin ${{ steps.increment-tag.outputs.new-tag }}
|
||||||
36
.gitea/workflows/ci.yaml
Normal file
36
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- uses: actions/setup-node@v5
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
- run: npm ci
|
||||||
|
- name: Format code
|
||||||
|
run: npm run format
|
||||||
|
- name: Typecheck
|
||||||
|
run: npm run typecheck
|
||||||
|
- name: Run test
|
||||||
|
run: npm run test
|
||||||
|
|
||||||
|
dry-run:
|
||||||
|
name: Dry-Run
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- run: npm ci
|
||||||
|
- name: Validate JSON, using a valid file
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
json-file: test/valid.json
|
||||||
|
- name: Validate JSON, using an invalid file
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
json-file: test/invalid.json
|
||||||
31
action.yml
Normal file
31
action.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: "Validate JSON by JSON Schema"
|
||||||
|
description: "Validates JSON files using their $schema reference"
|
||||||
|
author: "Timo Behrendt <t.behrendt@t00n.de>"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
json-file:
|
||||||
|
description: "The JSON file to validate"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Extract schema
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
// use jq to extract the $schema property from the json-file
|
||||||
|
schema=$(jq -r '.["$schema"]' < ${{ inputs.json-file }})
|
||||||
|
// if it's there, we fetch the schema from the URL
|
||||||
|
if [ -n "$schema" ]; then
|
||||||
|
curl -s $schema > schema.json
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
- name: Update the schema to the latest version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
npx ajv migrate -i schema.json -o schema.json
|
||||||
|
- name: Validate JSON
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
npx ajv validate -s schema.json -d ${{ inputs.json-file }}
|
||||||
3
renovate.json
Normal file
3
renovate.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||||
|
}
|
||||||
8964
schema.json
Normal file
8964
schema.json
Normal file
File diff suppressed because it is too large
Load Diff
4
test/invalid.json
Normal file
4
test/invalid.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"invalid": "invalid"
|
||||||
|
}
|
||||||
3
test/valid.json
Normal file
3
test/valid.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user