Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YAML validation workflow and schema definition #1

Merged
merged 7 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/consolidate.yml
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
24 changes: 24 additions & 0 deletions .github/workflows/validate_yaml.yml
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
10 changes: 10 additions & 0 deletions providers/MassaLabs.yaml
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: [email protected]
9 changes: 9 additions & 0 deletions schema.yaml
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}$')