Skip to content

init verify schema github action #8

init verify schema github action

init verify schema github action #8

name: Validate configuration files
on:
push:
branches:
- '**'
jobs:
validate_json_files:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout HEAD (current branch)
uses: actions/checkout@v4
with:
fetch-depth: 1 # Fetch only the latest commit of the current branch
- name: Save HEAD commit SHA
id: head
run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Checkout main branch
run: |
git fetch origin main --depth=1 # Fetch only the latest commit of main
git checkout FETCH_HEAD
echo "MAIN_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Calculate changed folders
run: |
echo "CHANGED_FOLDERS=protocol-name-1" >> $GITHUB_ENV
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Or your preferred version
- name: Merge JSON files
run: |
node validate-config.js