From f8f34fb8f578daa78635147feb5624bf85f6f62e Mon Sep 17 00:00:00 2001 From: Dmitry Kisler Date: Tue, 30 Jan 2024 23:33:45 +0100 Subject: [PATCH] add provider's JSON validation CI pipeline definition Signed-off-by: Dmitry Kisler --- .github/workflows/validate-json-provider.yml | 23 +++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate-json-provider.yml b/.github/workflows/validate-json-provider.yml index b1188baab9..0a6a633fee 100644 --- a/.github/workflows/validate-json-provider.yml +++ b/.github/workflows/validate-json-provider.yml @@ -15,14 +15,31 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - uses: actions/setup-go@v4 with: go-version-file: './src/go.mod' - - name: Validate JSON + - name: Build validator working-directory: ./src run: | - for path in $(git diff HEAD~1 HEAD --name-only) + mkdir -p /tmp/validate + go build -o /tmp/validate/run ./cmd/validate/main.go + chmod +x /tmp/validate/run + + - name: List updated filed + id: updated + uses: tj-actions/changed-files@v42 + with: + files: providers/**/*.json + + - name: Validate JSON + env: + CHANGED_FILES: ${{ steps.updated.outputs.all_changed_files }} + run: | + for path in "$CHANGED_FILES" do - go run ./cmd/validate/main.go provider $path + /tmp/validate/run provider "$path" done