Add autopatch to add schema to toml files
This commit is contained in:
parent
ee42a67e1c
commit
ccbfdaf3e2
3 changed files with 29 additions and 0 deletions
19
autopatches/patches/add-schemas/patch.sh
Normal file
19
autopatches/patches/add-schemas/patch.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
MANIFEST_SCHEMA_LINE='#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json'
|
||||
TESTS_SCHEMA_LINE='#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json'
|
||||
|
||||
|
||||
if [ -f "manifest.toml" ]; then
|
||||
if ! grep "#:schema" "manifest.toml" >/dev/null; then
|
||||
sed -i "1 s|^|$MANIFEST_SCHEMA_LINE\n|" manifest.toml
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "tests.toml" ]; then
|
||||
if ! grep "#:schema" "tests.toml" >/dev/null; then
|
||||
sed -i "1 s|^|$TESTS_SCHEMA_LINE\n|" tests.toml
|
||||
fi
|
||||
fi
|
||||
|
||||
git add manifest.toml tests.toml
|
9
autopatches/patches/add-schemas/pr_body.md
Normal file
9
autopatches/patches/add-schemas/pr_body.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
This is an ***automated*** patch to add the TOML schemas URLs to manifest.toml and tests.toml.
|
||||
|
||||
This allows to check for the validity of your TOML files.
|
||||
|
||||
Multiple tools can be used to validate files against their schema:
|
||||
|
||||
* `taplo`, a command line tool: `taplo lint manifest.toml`
|
||||
* IDEs like VScode have plugins to automagically validate files
|
1
autopatches/patches/add-schemas/pr_title.md
Normal file
1
autopatches/patches/add-schemas/pr_title.md
Normal file
|
@ -0,0 +1 @@
|
|||
Add TOML schemas URLs
|
Loading…
Reference in a new issue