Skip to content

init verify schema github action #5

init verify schema github action

init verify schema github action #5

name: Validate configuration files
on:
push:
branches:
- '**'
jobs:
merge_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: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Or your preferred version
- name: Calculate changed folders
run: |
echo "CHANGED_FOLDERS=$$(git diff --name-only $MAIN_SHA $HEAD_SHA -- 'protocols/*' | grep '^protocols/' | xargs -L1 dirname | sed 's|protocols/||' | sort -u)" >> $GITHUB_ENV
- name: Validate
run: |
node validate-config.js