From 26edeb2bf0af226c6f7aba123fee112b77ddf545 Mon Sep 17 00:00:00 2001 From: Karthikeyan C Date: Mon, 2 Sep 2024 14:04:14 +0530 Subject: [PATCH] change the logic of checking if the PR is approved --- .github/workflows/registry-updates-test.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/registry-updates-test.yaml b/.github/workflows/registry-updates-test.yaml index d17b2137..6263df43 100644 --- a/.github/workflows/registry-updates-test.yaml +++ b/.github/workflows/registry-updates-test.yaml @@ -26,6 +26,7 @@ jobs: uses: actions/github-script@v7 with: script: | + const core = require('@actions/core'); const { owner, repo } = context.issue; const pull_number = context.payload.pull_request.number; console.log("Owner and repo and pull_number", owner, repo, pull_number); @@ -35,15 +36,9 @@ jobs: pull_number: context.payload.pull_request.number, }); const approved = reviews.some(review => review.state === 'APPROVED'); - console.log("APPROVED IS ", approved); - return approved; - - - name: Cancel if not approved - if: steps.check-approval.outputs.approved == "false" - run: | - echo "************ check-approval {{ steps.check-approval.outputs.approved }}" - echo "The PR has not been approved. Cancelling the workflow." - exit 1 # This will exit the workflow early + if (!approved) { + core.setFailed('This workflow will only run when the PR is approved by someone') + } - name: Get all connector version package changes id: connector-version-changed-files