Skip to content

fix rule on validating config #21

fix rule on validating config

fix rule on validating config #21

name: Validate configuration files
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- 'main'
- 'fix-rule-on-validate-config'
jobs:
validate_json_files:
runs-on: ubuntu-latest
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: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Or your preferred version
- name: Validate JSON files
run: |
CHANGED_PROTOCOLS=$(git diff --name-only $HEAD_SHA $MAIN_SHA -- 'protocols/*' | grep '^protocols/' | xargs -L1 dirname | sed 's|protocols/||' | sort -u)
CHANGED_PROTOCOLS=$CHANGED_PROTOCOLS node validate-config.js