init verify schema github action #8
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
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 |