Skip to content

fix(ci): skip LFS hydration when no files are tracked - #6141

Merged
renecannao merged 1 commit into
GH-Actionsfrom
fix/ci-lfs-no-attributes
Aug 30, 2026
Merged

fix(ci): skip LFS hydration when no files are tracked#6141
renecannao merged 1 commit into
GH-Actionsfrom
fix/ci-lfs-no-attributes

Conversation

@renecannao

@renecannao renecannao commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Problem

PR #6135 changed CI-builds to hydrate LFS archives generically. On branches with no .gitattributes LFS entries, including v3.0, git lfs pull exits with status 1. All CI-builds matrix legs consequently fail before the build begins.

The hydration step also executed its branch-provided verifier loop for untrusted fork calls, despite the reusable workflow contract stating that only checkout runs in that mode.

Fix

  • Use git lfs ls-files --name-only to detect whether the checked-out branch tracks LFS files, and call git lfs pull only when it does.
  • Clear include/exclude filters for that pull so every tracked archive is hydrated.
  • Gate the hydration and verifier step on inputs.trusted, consistent with the fork-CI security model.

Verification

  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/ci-builds.yml")'
  • actionlint .github/workflows/ci-builds.yml

Local git-lfs is unavailable in this checkout; CI will exercise both the no-LFS v3.0 path and LFS-enabled branches.


Summary by cubic

Fixes CI builds failing on branches with no LFS-tracked files. git lfs pull previously ran unconditionally and exited 1 on branches without .gitattributes LFS entries, breaking every build before it started.

  • Git LFS hydration now enumerates tracked files and only pulls when any are present.
  • Hydration and source verification now run only for trusted inputs, matching the fork-CI security model.

Written for commit 01b01c8. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved build reliability for branches without Git LFS-tracked files.
    • Restricted vendored source archive hydration to trusted builds and skipped unnecessary LFS downloads.
    • Updated build guidance to reflect the revised archive handling behavior.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T10:14:05.935616Z 01b01c8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@gitar-bot

gitar-bot Bot commented Aug 30, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 77125e41-87b5-4857-a44a-f9399d36e1ac

📥 Commits

Reviewing files that changed from the base of the PR and between e13b8b2 and 01b01c8.

📒 Files selected for processing (1)
  • .github/workflows/ci-builds.yml

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: cubic · AI code reviewer
🧰 Additional context used
🪛 zizmor (1.29.0)
.github/workflows/ci-builds.yml

[warning] 250-299: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 1-915: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[warning] 103-915: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🔇 Additional comments (2)
.github/workflows/ci-builds.yml (2)

306-308: 🎯 Functional Correctness

The current checkout contains no verify-source.bash script, so the claimed failure path is not established.


257-257: 🔒 Security & Privacy

Verify the deployed untrusted caller before raising this finding.

Build runs on cache misses, actions/checkout@v4 persists the token by default, and the bin handoff archives .git/. However, the checked-out workflows contain no CI-builds-fork.yml or caller that passes trusted: false.

Establish the deployed caller and its token permissions before treating this as an exploitable fork path.


📝 Walkthrough

Walkthrough

The CI builds workflow now hydrates vendored source archives only for trusted inputs with LFS-tracked files. It avoids the unconditional git lfs pull failure on branches without LFS attributes.

Changes

CI LFS hydration

Layer / File(s) Summary
Guard vendored archive hydration
.github/workflows/ci-builds.yml
The step now requires inputs.trusted, lists LFS-tracked files, and runs git lfs pull --include="" --exclude="" only when the list is non-empty.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🟡 Moderate · up to 01b01

This workflow now avoids failing Git LFS hydration when no files are tracked and restricts hydration and source verification to trusted builds. However, the deployed fork-CI caller still uses an older workflow revision, so fork jobs do not receive the new security gate and may continue running repository-provided verification logic; update the caller pin or explicitly accept this gap before relying on the fix.

Poem

A rabbit checks the LFS trail,
Trusted paths unlock the rail.
If tracked files hop in sight,
Pull the archives clean and right.
Empty branches rest tonight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main CI change: skipping LFS hydration when no files are tracked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-lfs-no-attributes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@renecannao
renecannao merged commit 5eca996 into GH-Actions Aug 30, 2026
2 of 3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01b01c8302

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# test is what actually skips it.
- name: Hydrate vendored source archives
if: ${{ steps.cache-check.outputs.cache-hit != 'true' }}
if: ${{ inputs.trusted && steps.cache-check.outputs.cache-hit != 'true' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep LFS hydration enabled for untrusted builds

When inputs.trusted is false and the target ref contains LFS-managed dependencies, this condition skips hydration even though the later Build step at line 329 is not gated on inputs.trusted and therefore still runs. Because checkout sets GIT_LFS_SKIP_SMUDGE=1, that build receives pointer stubs instead of the vendored archives and fails. Either keep this non-privileged hydration step enabled for untrusted runs or also prevent the build from running in that mode.

Useful? React with 👍 / 👎.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant