Skip to content

Speed up staging with one targeted partial checkout - #894

Open
LukasWallrich wants to merge 3 commits into
mainfrom
perf/staging-checkout
Open

LukasWallrich wants to merge 3 commits into
mainfrom
perf/staging-checkout

Conversation

@LukasWallrich

Copy link
Copy Markdown
Contributor

Description

Staging currently downloads the full history of every branch and tag twice. In run 35240766210, those checkouts took 3m 51s of a 6m workflow; Hugo took 43s.

Aggregate PRs and build Hugo in one checkout. Fetch only the full ancestry of main and selected PR refs, using a blobless partial clone so historical file contents are downloaded on demand. PR refs support both same-repository and fork previews. Preserve Git-derived page dates, conflict skipping, manual single-PR previews, force deployment, and scheduled reporting. Deployment requires a successfully uploaded site artifact. Keep the staging write token scoped to the aggregation step's Git pushes rather than persisting it into the build.

Type of Change

  • Content/documentation update
  • New feature
  • Bug fix
  • Breaking change

Testing

Validation completed:

  • Actionlint passes with existing ShellCheck SC2129 style suggestions excluded; git diff --check passes.
  • Executed the workflow's fetch and aggregation commands against temporary Git repositories: successful merges, conflict recovery, fork PR refs, manual single-PR mode, no open PRs, and rejection of an invalid/closed PR.
  • Hugo page dates from the partial clone match a full clone, including an older page with an accented filename.
  • All 12 existing data-artifact tests pass.
  • A complete build of the real site from a fresh partial clone passes with the workflow's pinned Hugo 0.158.0 extended version: 3,545 pages and 180 processed images.

Checklist

  • Self-reviewed my changes
  • Verified links and formatting are correct
  • No new warnings or errors

Notes

A local cold checkout plus full main history took 55.4 seconds, with the history restoration taking under a second. These local timings are not directly comparable with GitHub-hosted runners; the PR's staging run will provide the hosted measurement. The existing queueing policy remains in place.

@richarddushime could you review the workflow changes, particularly the combined job, partial fetching, and deployment conditions?

@LukasWallrich
LukasWallrich requested a review from a team as a code owner September 17, 2026 15:56
@github-actions

Copy link
Copy Markdown
Contributor

👍 All image files/references (if any) are in webp format, in line with our policy.

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

✅ Spell Check Passed

No spelling issues found when checking 3 changed file(s)! 🎉

@LukasWallrich

LukasWallrich commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Staging Deployment Status

This PR has been successfully deployed to staging as part of an aggregated deployment.

Deployed at: 2026-09-17 18:53:01 UTC
Staging URL: https://staging.forrt.org

The staging site shows the combined state of all compatible open PRs.

@richarddushime

Copy link
Copy Markdown
Contributor

just made a commit to fix the Conflicts vs. other merge failures which are now distinct

I will check the rest later

@richarddushime richarddushime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A failed git fetch or gh pr view inside the merge loop aborts the whole aggregation under bash -e (verified: exit 128 at the first PR), so one deleted fork branch costs every other PR its staging preview — route fetch failures into the new failed bucket and continue.

gh pr list defaults to --limit 30, so a workflow documented as aggregating all open PRs silently stops doing so at 31 and says nothing in the log.

@richarddushime richarddushime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Line 153 already requests title and discards it, then line 186 re-fetches it per PR via gh pr view for a single log line — an API round trip per PR and another set -e failure point, both removable by reading number+title from the list call (headRefName is dead now too).

PYTHON_VERSION: "3.11" at line 382 is consumed by nothing — there's no actions/setup-python in the job, so it reads as a pin that isn't one.

The unguarded --unshallow at line 110 is correct today but hard-fails on a complete repository, so a future fetch-depth: 0 here would break the workflow without pointing at the cause.

Lines 459 and 627 still use github.event.inputs.create_summary while the PR moved force_deploy and single_pr to the inputs.* context — both work, but the file is now inconsistent with itself.

pull-requests: read on the build job is unused, since every gh call in it authenticates with the PAT rather than GITHUB_TOKEN.

git checkout main at line 171 is redundant because Fetch main history already left HEAD on main and nothing in between changes branch.

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.

2 participants