ci: skip pull request creation when only the analysis cache changes - #87
Merged
Merged
Conversation
The Update Builtin Tasks workflow opened a pull request whenever a new Unity version was found, even when the regenerated built-in tasks were identical to the ones already committed. Such a pull request carries no reviewable change. The generated code and the analysis cache are now compared separately against the default branch. A pull request is created only when the generated code differs. When only the analysis cache differs, the cache is committed directly to the working branch instead, so that the analyzed versions are not analyzed again on the next run. To make the cache reusable before the working branch is merged, the workflow now restores the analysis cache from that branch at the beginning of the run. Only the cache directory is restored, so the pull request is still opened against the default branch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ruccho
marked this pull request as ready for review
September 17, 2026 02:44
hkmt-mmy
approved these changes
Sep 17, 2026
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.
Background
The
Update Builtin Tasksworkflow opened a pull request whenever a new Unity version was detected. However, when a new version introduces no change to the APIs the built-in build tasks depend on, the regeneratedTasks.*.g.csfiles are identical to the ones already committed, and the only difference is inAnalysisCache/*.json. A pull request like that contains nothing to review.In addition, the analysis cache does not reach the default branch until the pull request is merged. If the workflow ran again while the pull request was still open, the same Unity versions were cloned from UnityCsReference and analyzed all over again.
Changes
Evaluate the generated code and the analysis cache separately
A
Detect changesstep now comparesGenerated/andAnalysisCache/against the default branch independently.Commit analysis cache onlystep commits and pushes the cache alone to the working branch (auto/update-builtin-tasks).Restore the analysis cache from the working branch
A
Restore analysis cache from the working branchstep restores only theAnalysisCachedirectory from the working branch when that branch exists. This lets an open, unmerged pull request still spare the next run from re-analyzing versions that have already been analyzed.The working branch itself is not checked out — only the cache directory is restored — so the pull request is still opened against the default branch. The restore has to happen before the new-version check (
Check for new Unity versions), which is why it is placed immediately above it.Other
fetch-depthofactions/checkoutis set to0, since the workflow now commits and pushes to the working branch.env(BRANCH,GENERATED_DIR).Notes
peter-evans/create-pull-requestrebuilds the branch from the base and force-pushes it. The contents of a cache-only commit are nevertheless preserved, because every run pulls the working branch's cache into the working tree before the generator runs.Once a pull request is merged the working branch is deleted, and the analysis cache lives on the default branch, so the restore step becomes a no-op.
Verification
The shell scripts embedded in the workflow were checked with
bash -n. Actual behavior is expected to be verified by a manualworkflow_dispatchrun after the merge.🤖 Generated with Claude Code