chore: fix PR ABI validation logic (v2)#109
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the PR ABI validation workflow to use an explicit should_run output flag and conditional step execution instead of relying on process termination semantics, ensuring predictable and controllable behavior of the job steps based on review approval status. Sequence diagram for ABI validation workflow control using should_run outputsequenceDiagram
actor Developer
participant GitHub
participant pr_validation_job
participant check_reviews_step
participant setup_jdk_step
participant abi_validation_step
Developer->>GitHub: Open or update pull_request
GitHub->>pr_validation_job: Trigger pr_validation workflow
pr_validation_job->>check_reviews_step: Run github-script
check_reviews_step->>check_reviews_step: core.setOutput(should_run, false)
check_reviews_step->>GitHub: github.rest.pulls.listReviews
GitHub-->>check_reviews_step: Review list
check_reviews_step->>check_reviews_step: Determine latest review per user
check_reviews_step->>check_reviews_step: Compute allApproved
alt allApproved is true
check_reviews_step->>check_reviews_step: core.setOutput(should_run, true)
else allApproved is false
check_reviews_step->>check_reviews_step: Log skipping message
end
pr_validation_job->>setup_jdk_step: Run Set up JDK (always runs)
alt should_run == true
pr_validation_job->>abi_validation_step: Run ABI Validation
abi_validation_step->>abi_validation_step: ./gradlew checkLegacyAbi
else should_run == false
pr_validation_job-->>abi_validation_step: Skip due to if condition
end
Flow diagram for updated should_run decision logic in check_reviews stepflowchart TD
A[Start check_reviews script] --> B[Set output should_run = false]
B --> C[Fetch PR reviews via github.rest.pulls.listReviews]
C --> D[Build latestReviews map per user]
D --> E[Extract states and compute allApproved]
E -->|allApproved == true| F[Log: All reviewers approved]
F --> G[Set output should_run = true]
E -->|allApproved == false| H[Log: Skipping ABI validation]
G --> I[End script]
H --> I[End script]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the review-check script, relying on the initial default
core.setOutput('should_run', 'false')makes theelsebranch implicit; consider explicitly setting it back to'false'in theelseblock for clearer, more robust logic if the script is modified later. - The workflow comment
// Initialize with a default value as suggested by AI reviewis meta-process detail; consider simplifying or removing it so the file focuses on behavior rather than how the change was decided. - The PR description mentions adding
ifconditions to all dependent steps, but only theABI Validationstep is gated; double-check whetherSet up JDK(and any other steps that should be skipped) also need theshould_runcondition for consistency with the intended behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the review-check script, relying on the initial default `core.setOutput('should_run', 'false')` makes the `else` branch implicit; consider explicitly setting it back to `'false'` in the `else` block for clearer, more robust logic if the script is modified later.
- The workflow comment `// Initialize with a default value as suggested by AI review` is meta-process detail; consider simplifying or removing it so the file focuses on behavior rather than how the change was decided.
- The PR description mentions adding `if` conditions to all dependent steps, but only the `ABI Validation` step is gated; double-check whether `Set up JDK` (and any other steps that should be skipped) also need the `should_run` condition for consistency with the intended behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses logic issues and incorporates AI review feedback for the ABI validation workflow.
Changes:
process.exit(0): Used structuredoutputsto control subsequent steps, asprocess.exit(0)doesn't stop following steps in a job.core.setOutput('should_run', 'false')at the beginning of the script to ensure the variable has a predictable default state, as suggested by AI review.ifconditions to all dependent steps.Note:
The previous PR (#108) was deleted/closed due to branch sync issues. This is the updated version on a clean branch.
Submitted by AI (Aliorpse's Token)