Skip to content

Commit a125893

Browse files
authored
chore: fix PR ABI validation logic (#109)
1 parent c5ca412 commit a125893

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

.github/workflows/pr_validation.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v4
14-
with:
15-
ref: ${{ github.event.pull_request.head.sha }}
16-
1713
- name: Check Review Status
1814
id: check_reviews
1915
uses: actions/github-script@v7
2016
with:
2117
script: |
18+
core.setOutput('should_run', 'false');
19+
2220
const { data: reviews } = await github.rest.pulls.listReviews({
2321
owner: context.repo.owner,
2422
repo: context.repo.repo,
@@ -33,14 +31,19 @@ jobs:
3331
const states = Object.values(latestReviews);
3432
const allApproved = states.length > 0 && states.every(state => state === 'APPROVED');
3533
36-
if (!allApproved) {
37-
console.log("Skipping ABI validation because not all reviewers approved.");
38-
core.setOutput('should_run', 'false');
39-
} else {
34+
if (allApproved) {
4035
console.log("All reviewers approved. Proceeding with validation.");
4136
core.setOutput('should_run', 'true');
37+
} else {
38+
console.log("Skipping ABI validation because not all reviewers approved.");
39+
core.setOutput('should_run', 'false');
4240
}
4341
42+
- uses: actions/checkout@v4
43+
if: steps.check_reviews.outputs.should_run == 'true'
44+
with:
45+
ref: ${{ github.event.pull_request.head.sha }}
46+
4447
- name: Set up JDK
4548
if: steps.check_reviews.outputs.should_run == 'true'
4649
uses: actions/setup-java@v4
@@ -55,4 +58,4 @@ jobs:
5558

5659
- name: ABI Validation
5760
if: steps.check_reviews.outputs.should_run == 'true'
58-
run: ./gradlew checkLegacyAbi -Pfull-build=true --no-configuration-cache
61+
run: ./gradlew checkLegacyAbi -Pfull-build=true --no-configuration-cache

0 commit comments

Comments
 (0)