-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Added Workflow to verify ambassaor.json schema #758
Merged
Merged
Changes from 49 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
61b331d
Added Workflow to verify ambassaor.json schema
ramishj d4ccdfa
Added Workflow to verify ambassaor.json schema
ramishj 37a16c5
Added Workflow to verify ambassaor.json schema
ramishj 7004de4
Added Workflow to verify ambassaor.json schema
ramishj bc0301f
Added Workflow to verify ambassaor.json schema
ramishj baaae11
Added Workflow to verify ambassaor.json schema
ramishj 724a856
Added Workflow to verify ambassaor.json schema
ramishj 60bd8dc
Added Workflow to verify ambassaor.json schema
ramishj 5c9dfc7
Added Workflow to verify ambassaor.json schema
ramishj b24135b
Added Workflow to verify ambassaor.json schema
ramishj 261511e
Create blank.yml
ramishj 9c34895
Added Workflow to verify ambassaor.json schema
ramishj 56635fb
Added Workflow to verify ambassaor.json schema
ramishj a21cd44
Create Validate Ambassadors JSON.yml
ramishj 7a99bb6
Delete .github/workflows/validate-ambassadors.yml
ramishj 4d37b38
Delete .github/workflows/blank.yml
ramishj 5edf727
Added Workflow to verify ambassaor.json schema
ramishj a6a6fcc
Merge branch 'main' of https://github.com/ramishj/community
ramishj 6f4bf57
Added Workflow to verify ambassaor.json schema
ramishj f3b9cd0
Update Validate Ambassadors JSON.yml
ramishj e7a58bc
Update Validate Ambassadors JSON.yml
ramishj cb707ad
Update Validate Ambassadors JSON.yml
ramishj 83ee27d
Update Validate Ambassadors JSON.yml
ramishj 8dc36ca
Update Validate Ambassadors JSON.yml
ramishj bf66dc5
Update Validate Ambassadors JSON.yml
ramishj 86ce0d8
Added Workflow to verify ambassaor.json schema
ramishj 7a9bd19
Update Validate Ambassadors JSON.yml
ramishj a472f6a
Added Workflow to verify ambassaor.json schema
ramishj 05c338e
Added Workflow to verify ambassaor.json schema
ramishj 4e5f49f
Added Workflow to verify ambassaor.json schema
ramishj 46b51e6
Added Workflow to verify ambassaor.json schema
ramishj 50b9097
Added Workflow to verify ambassaor.json schema
ramishj 48ec5b8
Added Workflow to verify ambassaor.json schema
ramishj 7d3c563
Added Workflow to verify ambassaor.json schema
ramishj 5573ee3
Added Workflow to verify ambassaor.json schema
ramishj 8025764
Added Workflow to verify ambassaor.json schema
ramishj 10bd026
Added Workflow to verify ambassaor.json schema
ramishj c880b3e
Added Workflow to verify ambassaor.json schema
ramishj 91d6af8
Added Workflow to verify ambassaor.json schema
ramishj 1aca772
Added Workflow to verify ambassaor.json schema
ramishj 3cb88ac
Added Workflow to verify ambassaor.json schema
ramishj d4c2655
Added Workflow to verify ambassaor.json schema
ramishj 880f5f7
Added Workflow to verify ambassaor.json schema
ramishj 0110c60
Added Workflow to verify ambassaor.json schema
ramishj a1c5369
Added Workflow to verify ambassaor.json schema
ramishj fa09281
Update .github/workflows/Validate Ambassadors JSON.yml
ramishj 9adb1a8
Update ambassadors-schema.json
ramishj 8a440dd
Update Validate Ambassadors JSON.yml
ramishj 762d2d1
add mastodon optional property
benjagm 2e4d8b9
Update Validate Ambassadors JSON.yml
ramishj 96d0586
Update Validate Ambassadors JSON.yml
ramishj 4b668fb
Update Validate Ambassadors JSON.yml
ramishj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,60 @@ | ||
name: Validate Ambassadors JSON | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'programs/ambassadors/ambassadors.json' | ||
pull_request: | ||
paths: | ||
- 'programs/ambassadors/ambassadors.json' | ||
|
||
jobs: | ||
validate-json: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node 20 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install Dependencies | ||
run: npm install ajv ajv-formats | ||
|
||
- name: Validate ambassadors.json | ||
run: | | ||
node -e " | ||
const Ajv = require('ajv'); | ||
const addFormats = require('ajv-formats'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
const ambassadorsDir = path.join(process.env.GITHUB_WORKSPACE, 'programs', 'ambassadors'); | ||
const schemaPath = path.join(ambassadorsDir, 'ambassadors-schema.json'); | ||
const dataPath = path.join(ambassadorsDir, 'ambassadors.json'); | ||
|
||
try { | ||
const schema = JSON.parse(fs.readFileSync(schemaPath, 'utf-8')); | ||
const data = JSON.parse(fs.readFileSync(dataPath, 'utf-8')); | ||
|
||
const ajv = new Ajv({ allErrors: true }); | ||
addFormats(ajv); | ||
|
||
const validate = ajv.compile(schema); | ||
const valid = validate(data); | ||
|
||
if (!valid) { | ||
console.error('Validation failed:', validate.errors); | ||
process.exit(1); | ||
} else { | ||
console.log('ambassadors.json is valid.'); | ||
} | ||
} catch (error) { | ||
console.error('Error validating ambassadors.json:', error); | ||
process.exit(1); | ||
}" | ||
|
||
|
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,96 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"type": "array", | ||
benjagm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"description": "Array of contributor profiles", | ||
"items": { | ||
"type": "object", | ||
"description": "Contributor profile", | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "Full name of the contributor" | ||
}, | ||
"img": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "URL to the contributor's profile image" | ||
}, | ||
"bio": { | ||
"type": "string", | ||
"description": "Brief biography of the contributor" | ||
}, | ||
"title": { | ||
"type": "string", | ||
"description": "Professional title of the contributor" | ||
}, | ||
"github": { | ||
"type": "string", | ||
"description": "GitHub profile URL of the contributor" | ||
}, | ||
"twitter": { | ||
"type": "string", | ||
"description": "Twitter profile URL of the contributor" | ||
}, | ||
"mastodon": { | ||
"type": "string", | ||
"description": "Mastodon profile URL of the contributor" | ||
}, | ||
"linkedin": { | ||
"type": "string", | ||
"description": "LinkedIn profile URL of the contributor" | ||
}, | ||
"company": { | ||
"type": "string", | ||
"description": "Company where the contributor works" | ||
}, | ||
"country": { | ||
"type": "string", | ||
"description": "Country where the contributor is based" | ||
}, | ||
"contributions": { | ||
"type": "array", | ||
"description": "List of contributions made by the contributor", | ||
"items": { | ||
"type": "object", | ||
"description": "Details of a specific contribution", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["article", "talk", "video", "other", "book", "paper", "initiative", "project", "working group"], | ||
"description": "Type of the contribution" | ||
}, | ||
"title": { | ||
"type": "string", | ||
"description": "Title of the contribution" | ||
}, | ||
"date": { | ||
"type": "object", | ||
"description": "Date of the contribution", | ||
"properties": { | ||
"year": { | ||
"type": "integer", | ||
"minimum": 1900, | ||
"maximum": 2100, | ||
"description": "Year of the contribution" | ||
}, | ||
"month": { | ||
"type": "string", | ||
"enum": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], | ||
"description": "Month of the contribution" | ||
} | ||
}, | ||
"required": ["year", "month"] | ||
}, | ||
"link": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "URL link to the contribution" | ||
} | ||
}, | ||
"required": ["type", "title", "date", "link"] | ||
} | ||
} | ||
}, | ||
"required": ["name", "img", "bio", "title", "github", "company", "country", "contributions"] | ||
} | ||
} |
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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
[ | ||
{ | ||
"name": "I am the first Ambassador", | ||
"img": "https://avatars.githubusercontent.com/u/40007659?v=4", | ||
"bio": "I am the first JSON Schema Ambassador. I work as Schema Designer in ACME since 2002 and I am the implementer of the Turbo Implementation.", | ||
"title": "Schema Designer at ACME", | ||
"github": "iamthefirst", | ||
"twitter": "iamthefirst", | ||
"linkedin": "iamthefirst", | ||
"company": "ACME", | ||
"country": "🇺🇸", | ||
"contributions": [ | ||
{ | ||
"type": "article", | ||
"title": "Title of my first contribution", | ||
"date": { | ||
"year": 2024, | ||
"month": "May" | ||
}, | ||
"link": "link-to-my-contribution" | ||
} | ||
] | ||
} | ||
{ | ||
"name": "I am the first Ambassador", | ||
"img": "https://avatars.githubusercontent.com/u/40007659?v=4", | ||
"bio": "I am the first JSON Schema Ambassador. I work as Schema Designer in ACME since 2002 and I am the implementer of the Turbo Implementation.", | ||
"title": "Schema Designer at ACME", | ||
"github": "iamthefirst", | ||
"twitter": "iamthefirst", | ||
"linkedin": "iamthefirst", | ||
"company": "ACME", | ||
"country": "🇺🇸", | ||
"contributions": [ | ||
{ | ||
"type": "article", | ||
"title": "Title of my first contribution", | ||
"date": { | ||
"year": 2024, | ||
"month": "May" | ||
}, | ||
"link": "https://github.com/my-contri" | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To run the validation against a 2020-12 schema the dependency to use is:
ajv/dist/2020
Right now the action is failing:
https://github.com/json-schema-org/community/actions/runs/9631882401