This repo contains:
- JSON schema for Thunderbird notifications
- scripts for converting from YAML to JSON
- scripts for validating JSON against the schema
- GitHub actions to run conversion and validation
To run the scripts locally (and/or to test the GitHub actions locally), follow these instructions to install the dependencies.
Here's a cheat sheet for running the commands after you've completed the installation steps:
# Activate virtualenv
source ./venv/bin/activate
# Manually convert yaml/*.yaml to JSON
# (default output is json/notifications.json)
python convert-yaml.py yaml
# Manually convert YAML to JSON, specifying output file
python convert-yaml.py yaml output.json
# Manually validate JSON files in the `json` directory
python validate-json.py schema.json json
# Simulate pull request (to validate JSON)
act pull_request --artifact-server-path /tmp
# Simulate push (to convert YAML to JSON)
act push --artifact-server-path /tmp
python3 -m venv venv
source ./venv/bin/activate # for bash-like shells
pip install -r requirements.txt
Run the convert-yaml.py
script like so:
python convert-yaml.py yaml json
If there's a single yaml/example.yaml
file,
running this command should produce a corresponding json/example.json
file.
The validate-json.py
script uses this tool written in Go: https://github.com/santhosh-tekuri/jsonschema
.
You'll need to install it (and Go) in order to run the validator locally.
Follow the official docs for installing for your OS.
go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest
python validate-json.py schema.json json
Follow the installation documentation for your OS
Note: this tool depends on having Docker (e.g., Docker Desktop on MacOS or Docker Engine on Linux) installed.
To test the validate workflow in standalone mode.
act pull_request
To the the convert workflow (which calls validate before attempting to commit):
act push --artifact-server-path /tmp
This action uses the artifact server, which requires the --artifact-server-path
option. (Re this comment in the act
repo.)