-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate-workflow.ps1
44 lines (36 loc) · 1.12 KB
/
create-workflow.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$workflowContent = @"
name: Validate JSON Files
on:
push:
paths:
- 'src/data/*.json'
- 'src/data/schemas/*.json'
pull_request:
paths:
- 'src/data/*.json'
- 'src/data/schemas/*.json'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install -g ajv-cli ajv-formats
- name: Validate conferences.json
run: |
ajv validate -s src/data/schemas/conferences.schema.json -d src/data/conferences.json --strict=false --all-errors
- name: Validate meetups.json
run: |
ajv validate -s src/data/schemas/meetups.schema.json -d src/data/meetups.json --strict=false --all-errors
"@
# Ensure the directory exists
if (-not (Test-Path ".github/workflows")) {
New-Item -ItemType Directory -Path ".github/workflows" -Force
}
# Write the workflow file
$workflowContent | Out-File -FilePath ".github/workflows/validate-json.yml" -Encoding utf8