diff --git a/.github/workflows/pr_validation.yml b/.github/workflows/pr_validation.yml index af5769e..ef9e123 100644 --- a/.github/workflows/pr_validation.yml +++ b/.github/workflows/pr_validation.yml @@ -10,15 +10,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Check Review Status id: check_reviews uses: actions/github-script@v7 with: script: | + core.setOutput('should_run', 'false'); + const { data: reviews } = await github.rest.pulls.listReviews({ owner: context.repo.owner, repo: context.repo.repo, @@ -33,14 +31,19 @@ jobs: const states = Object.values(latestReviews); const allApproved = states.length > 0 && states.every(state => state === 'APPROVED'); - if (!allApproved) { - console.log("Skipping ABI validation because not all reviewers approved."); - core.setOutput('should_run', 'false'); - } else { + if (allApproved) { console.log("All reviewers approved. Proceeding with validation."); core.setOutput('should_run', 'true'); + } else { + console.log("Skipping ABI validation because not all reviewers approved."); + core.setOutput('should_run', 'false'); } + - uses: actions/checkout@v4 + if: steps.check_reviews.outputs.should_run == 'true' + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Set up JDK if: steps.check_reviews.outputs.should_run == 'true' uses: actions/setup-java@v4 @@ -55,4 +58,4 @@ jobs: - name: ABI Validation if: steps.check_reviews.outputs.should_run == 'true' - run: ./gradlew checkLegacyAbi -Pfull-build=true --no-configuration-cache \ No newline at end of file + run: ./gradlew checkLegacyAbi -Pfull-build=true --no-configuration-cache