Skip to content

init verify schema github action #12

init verify schema github action

init verify schema github action #12

name: Validate configuration files
on:
push:
branches:
- '**'
jobs:
validate_json_files:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
- name: Checkout main branch
run: |
echo "MAIN_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Save HEAD commit SHA
run: |
echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Get changed protocols
run: |
export CHANGED_FOLDERS=$(git diff --name-only HEAD^ HEAD -- 'protocols/*' | grep '^protocols/' | xargs -L1 dirname | sed 's|protocols/||' | sort -u)
echo "CHANGED_FOLDERS=$CHANGED_FOLDERS" >> $GITHUB_ENV
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Or your preferred version
- name: Validate JSON files
run: |
node validate-config.js