Repository navigation
CI: Partial-clone metadata checkout, add timeout - #165
ModeSevenIndustrialSolutions merged 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
In private repositories, disabling persisted credentials can prevent rename detection from fetching historical blobs, causing empty changed-file metadata across all four affected workflows.
1 open issue
What changed in this PR
This PR reduces metadata checkout transfers for repositories with heavy branch history and makes the metadata job timeout configurable across all four reusable workflows.
Changes:
- Adds
filter: 'blob:none'while retaining full commit history for metadata extraction. - Adds and validates
metadata_timeout_minuteswith a five-minute default and a 1–360 whole-minute range. - Documents the checkout behavior and timeout input; leaves tag-validation and Gerrit checkouts unchanged.
| File | Description |
|---|---|
| README.md | Documents metadata partial clones and the configurable timeout. |
| .github/workflows/build-test.yaml | Adds metadata checkout filtering and timeout configuration. |
| .github/workflows/build-test-release.yaml | Applies the metadata changes to the release workflow. |
| .github/workflows/build-test-release-multiarch.yaml | Applies the metadata changes to multiarchitecture releases. |
| .github/workflows/build-test-multiarch.yaml | Applies the metadata changes to multiarchitecture builds and tests. |
Review effort: Balanced
|
On the Copilot finding about private repositories: it is right, and the simplest fix that keeps the credential boundary is to apply the filter only to repositories known to be public: filter: ${{ github.event.repository.private == false && 'blob:none' || '' }}Compare against |
b0f3b60
abe79e1 to
b0f3b60
Compare
|
Copilot's latest finding is correct, and the error is in the condition I suggested above: GitHub Actions expressions coerce both filter: >-
${{ toJSON(github.event.repository.private) == 'false'
&& 'blob:none' || '' }}Apply it in all four workflows, keep the explanatory comment (mention why |
The repository-metadata job checks out with fetch-depth: 0, which fetches every blob on every branch. One heavy branch therefore sets the clone time for all runs: in project-reporting-tool a 1.68 GiB gh-pages branch pushed the checkout past the job's five-minute timeout before the metadata action ran. The metadata action reads commits and trees for its changed-file detection, not file contents, so add filter: 'blob:none' to that checkout in all four reusable workflows. History for every ref is still fetched; blobs arrive on demand. Apply the filter only when the event payload marks the repository public explicitly (toJSON(github.event.repository.private) == 'false'). Review finding PRRT_kwDOS3n55c6zUYFu: rename detection in the metadata action can read historical blobs, and with persist-credentials: false a private repository cannot fetch them lazily, so its changed-file metadata could come back empty. Private repositories, and events whose payload has no repository object (schedule), get an empty filter, which actions/checkout treats as none, and keep today's full clone. Public repositories fetch any blob they need anonymously. No token is added. Review finding PRRT_kwDOS3n55c6zVJNw: the earlier condition (private == false) also matched a payload with no repository object, because the expression == operator coerces both null and false to 0. Compare the JSON form instead, as the maintainer asked: toJSON(null) is 'null', so only an explicit false enables the filter. tag-validate keeps its full clone: it verifies tag signatures, and its needs have not been confirmed against tag-validate-action. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
The repository-metadata job had a hardcoded five-minute timeout, so a caller whose repository is slow to clone had no way to raise it, unlike the build, test, audit and CBOM jobs. Expose metadata_timeout_minutes (number, default 5) in all four reusable workflows, validate it with the other timeout inputs, and use it as the job's timeout. The default keeps today's behaviour. Private repositories keep the full clone, so the README names them as the likeliest callers to raise it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
b0f3b60 to
52d824b
Compare
475d3ae
into
lfreleng-actions:main

Closes #164
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI57116e041fba93d4a502366a3fe0725f73222515prek run --files .github/workflows/build-test.yaml .github/workflows/build-test-release.yaml .github/workflows/build-test-multiarch.yaml .github/workflows/build-test-release-multiarch.yaml README.mdzizmor --offline --persona auditor .github/workflows/prek run --hook-stage commit-msg --commit-msg-filename <message of 'CI: Use partial clone for metadata checkout'>prek run --hook-stage commit-msg --commit-msg-filename <message of 'Feat: Add metadata_timeout_minutes input'> (gitlint B1 on the bot's real Signed-off-by trailer only; commit unchanged this round)aislop scan --changes --base 57116e041fba93d4a502366a3fe0725f73222515 --json .git log --raw --format=%h 57116e041fba93d4a502366a3fe0725f73222515..HEADThe
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds; a maintainer must act on any finding that remains after that, and reviews every round before merge.
Round 2 of revision, on its base.
Closes #164.
What this does
repository-metadatacheckout in all four reusable workflows (build-test,build-test-release,build-test-multiarch,build-test-release-multiarch). It keepsfetch-depth: 0and addsfilter: 'blob:none', so git fetches commits and trees for every ref and defers file contents. A heavy branch (such as a largegh-pages) no longer sets the clone time for every run.toJSON(github.event.repository.private) == 'false'. The checkout does not persist credentials, so a private repository could not fetch a blob that rename detection needs later. Private repositories, and events whose payload has norepositoryobject (such asschedule), get an empty filter and keep the full clone. No token is added.metadata_timeout_minutesinput (number, default5) in all four workflows. It is validated with the other timeout inputs and used as the job timeout. The default keeps today's behaviour.README.mddocuments the filter condition and the new input.tag-validatekeeps its full clone: it verifies tag signatures, and its needs have not been confirmed againsttag-validate-action.This round
PRRT_kwDOS3n55c6zVJNw(fixed, as the maintainer asked):github.event.repository.private == falsealso matched a missingrepositoryobject, because the expression==operator coerces bothnullandfalseto0. The condition now compares the JSON form (toJSON(null)is'null'), so only an explicitfalseenables the filter. The comment beside each checkout says whytoJSONis needed, and the README states the new condition. The fix is amended into the partial-clone commit.mainat 57116e0.Checks run
prek run --fileson the five changed files: pass (actionlint, zizmor, yamllint, markdownlint, workflow validators included)zizmor --offline --persona auditor .github/workflows/: no findingsprek run --hook-stage commit-msg: pass on the reworded commitaislop scan --changes --base 57116e0: zero diagnosticsFor reviewers
toJSON(github.event.repository.private) == 'false'gives the behaviour you want for the events your callers use.pull_requestandpushcarry therepositoryobject;scheduledoes not.