From 20ca1f95a2b020bafe60147665591b71ca3e70d8 Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Fri, 5 Apr 2024 20:41:47 +0530 Subject: [PATCH] fix: update code, replace JS script with bash Changes: - replaced the JavaScript code with bash script - suggested by Sergio here: https://github.com/asyncapi/spec/pull/1046#discussion_r1549818498 --- .github/workflows/validate-examples.yml | 40 +++++++------------------ 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/.github/workflows/validate-examples.yml b/.github/workflows/validate-examples.yml index 19f6a309..d6d3f945 100644 --- a/.github/workflows/validate-examples.yml +++ b/.github/workflows/validate-examples.yml @@ -3,8 +3,8 @@ name: Validate AsyncAPI Examples on: push: branches: - - master - script-ci-spec-validation # added temporarily for testing purpose + # - master pull_request_target: types: [opened, reopened, synchronize, edited, ready_for_review] @@ -48,32 +48,14 @@ jobs: - if: steps.should_run.outputs.shouldrun == 'true' name: Checkout repository uses: actions/checkout@v3 - - if: steps.should_run.outputs.shouldrun == 'true' - name: Check if Node.js project and has package.json - id: packagejson - run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT - shell: bash - - if: steps.packagejson.outputs.exists == 'true' - name: Check package-lock version - uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master - id: lockversion - - if: steps.packagejson.outputs.exists == 'true' - name: Setup Node.js - uses: actions/setup-node@v3 + - name: Find YAML files + run: | + files=$(find examples/ \( -path 'examples/social-media/*' -prune \) -o -type f \( -name "*.yml" -o -name "*.yaml" \)) + echo "::set-output name=files::$files" + + - name: Validate AsyncAPI documents + uses: asyncapi/github-action-for-cli@v3.1.1 with: - node-version: "${{ steps.lockversion.outputs.version }}" - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - if: steps.packagejson.outputs.exists == 'true' - name: Install dependencies - id: first-installation - run: npm install --loglevel verbose - continue-on-error: true - - if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true' - name: Clear NPM cache and install deps again - run: | - npm cache clean --force - npm install --loglevel verbose - - if: steps.packagejson.outputs.exists == 'true' - name: Validate examples - run: npm run validate:examples \ No newline at end of file + command: custom + arguments: | + validate ${{ steps.FindYAMLFiles.outputs.files }}