-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add YAML validation workflow and schema definition (#1)
* Add YAML validation workflow and schema definition * Remove useless category for providers schema * Add Massa Labs provider * Fix wrong providers files paths in validate workflow * Fix schema and add regex validation for URL and contact fields * Update workflow to use Ubuntu 22.04 for YAML validation * Add workflow to consolidate YAML files and upload as artifact
- Loading branch information
1 parent
f481e01
commit e9124ee
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Consolidate YAML Files | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
consolidate_yaml: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Consolidate YAML files | ||
uses: mikefarah/yq@v4 | ||
with: | ||
cmd: yq eval-all '. as $item ireduce ([]; . + [$item])' providers/*.yaml > providers.yaml | ||
|
||
- name: Upload providers.yaml as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: providers.yaml | ||
|
||
- name: Commit and push consolidated file | ||
if: github.ref == 'refs/heads/main' | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "Auto-update providers.yaml" | ||
file_pattern: providers.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Validate providers YAMLs | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'providers/**/*.yaml' | ||
|
||
jobs: | ||
validate_yaml: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Yamale | ||
run: | | ||
pip install yamale | ||
- name: Validate YAML against schema | ||
run: | | ||
for file in providers/*.yaml; do | ||
yamale -s schema.yaml "$file" || exit 1 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
title: Massa Labs Official Provider | ||
|
||
url: https://massa.network/ | ||
|
||
desc: The Official DeWeb Provider hosted by Massa Labs. Only allows access to officials Massa websites and some partner websites. | ||
|
||
owner: Massa Labs | ||
|
||
contact: | ||
email: contact@massa.net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
title: str(required=True) | ||
url: str(required=True, regex='^https?://[\\w.-]+(?:\\.[\\w\\.-]+)+[/\\w\\.-]*$') | ||
desc: str(required=True) | ||
owner: str(required=True) | ||
contact: map(required=True) | ||
contact: | ||
email: str(required=False, regex='^[\\w\\.-]+@[\\w\\.-]+\\.[a-zA-Z]{2,}$') | ||
discord: str(required=False, regex='^@\\w{2,32}#\\d{4}$') | ||
telegram: str(required=False, regex='^@\\w{5,32}$') |