Seed pre-commit cache from main builds #2289
<!-- coderabbit-ai-generated:v1 -->
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->
<a href="https://app.coderabbit.ai/change-stack/NVIDIA/cuopt/pull/2289?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a>
<!-- review_stack_entry_end -->
<!-- recent_review_status_start -->
No actionable comments were generated in the recent review.
<!-- recent_review_status_end -->
<!-- walkthrough_start -->
<details>
<summary><strong>Walkthrough</strong></summary>
<dl>
<dd>
<br>
The build workflow adds a main-only checks job that uses the shared checks workflow and seeds the pre-commit cache. The PR workflow configures the cache as read-only.
Changes: Checks Workflow
|Layer / File(s)|Summary|
|:---|:---|
|Checks workflow and cache behavior <br> .github/workflows/build.yaml, .github/workflows/pr.yaml|The build workflow adds a checks job that runs only on main, uses read-only Actions and contents permissions, and seeds the pre-commit cache with base-branch: main. It disables five checks. The PR workflow sets pre-commit-cache-read-only: true and adds comments about cache use by PR merge refs and avoiding duplicate archives.|
<!-- change_assessment_start -->
Estimated code review effort: 2 (Simple) | ~8 minutes
<!-- change_assessment_commit:"cbfb311b6d99e032c02ebf0c1138856707a091a3" -->
<!-- change_assessment_priority:{"version":1,"urgency":"p3","manual":false} -->
Change: Other
<!-- change_assessment_end -->
Suggested labels: improvement, non-breaking
Suggested reviewers: ramakrishnap-nv
</dd>
</dl>
</details>
<!-- walkthrough_end -->
<details>
<summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>cbfb3</code></summary>
<dl>
<dd>
<br>
<!-- final_review_risk_start -->
<!-- final_review_risk_label
Merge Risk: ⚪ Minimal · up to cbfb3
-->
<!-- final_review_risk_coverage:{"sourceCommitId":"cbfb311b6d99e032c02ebf0c1138856707a091a3","coveredCommitId":"cbfb311b6d99e032c02ebf0c1138856707a091a3","kind":"reviewed"} -->
No actionable merge-blocking issue was found; cache reuse depends on a matching main-branch archive being available.
<!-- final_review_risk_end -->
</dd>
</dl>
</details>
<!-- pre_merge_checks_walkthrough_start -->
<details>
<summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 5</strong></summary>
<dl>
<dd>
<br>
| Check name | Status | Explanation |
| :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Title check | !Passed | The title identifies the main change: seeding the pre-commit cache from main builds. |
| Description check | !Passed | The description matches the cache-seeding and read-only PR workflow changes. |
| Docstring Coverage | !Passed | No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… |
| Linked Issues check | !Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | !Passed | Check skipped because no linked issues were found for this pull request. |
<details>
<summary><strong>Full details: Docstring Coverage</strong></summary>
<dl>
<dd>
<br>
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->
<details>
<summary><strong>Finishing Touches</strong></summary>
<dl>
<dd>
<br>
<details open>
<summary><strong>Generate unit tests (beta)</strong></summary>
<dl>
<dd>
<br>
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<!-- finishing_touch_checkbox_end -->
<!-- autopilot:start -->
<!-- autopilot:end -->
<!-- recent_review_start -->
<h6>
<details>
<summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary>
<dl>
<dd>
<br>
<!-- review_info_content -->
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary>
<dl>
<dd>
<br>
67a4f501-d17b-42e7-86bb-255fd25ab474</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary>
<dl>
<dd>
<br>
Reviewing files that changed from the base of the PR and between 1af75d9e60a6137813f40a175157fe683f06ea1b and cbfb311b6d99e032c02ebf0c1138856707a091a3.
</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 2</strong></summary>
<dl>
<dd>
<br>
.github/workflows/build.yaml
.github/workflows/pr.yaml
</dd>
</dl>
</details>
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.
</dd>
</dl>
</details>
</h6>
<!-- recent_review_end -->
Approved these changes.
<!-- pr-test-summary -->
CI Test Summary
1 failed · 27 passed · 0 skipped
<details>
<summary><code>conda-cpp-tests-mathopt / 13.0.3, 3.12, amd64, linux, ubuntu24.04, rtxpro6000, latest-driver, latest-deps</code> — 1 failed test</summary>
INCUMBENT_CALLBACK_TEST (crashed: SIGABRT)</details>
Approved these changes.
/merge
cryos
bdice
Run the shared
checksworkflow as a style-only job onmainbuilds so it writes the pre-commit cache, and make PRchecksrestore that cache read-only.Today pre-commit cache entries are scoped to each PR's merge ref, which other PRs cannot read. The first style check on every PR runs cold, and the per-PR entries fill the repository's GitHub Actions cache quota.
Mirrors https://github.com/NVIDIA/cudf/pull/24093.
Part of https://github.com/rapidsai/build-planning/issues/332.