Repository navigation
ci: stop committing the UI bundle from CI; contributors commit it - #54
Conversation
The push-to-main step failed on every merge: it rebuilt build/ui-bundle.zip and pushed it straight to main as github-actions[bot], which the branch protection on main rejects (require a pull request, and require the build check that a direct push can never have). See the failed run on the tigergraph#53 merge. Instead of fighting protection with tokens or a bot bypass, drop the auto-commit entirely. Contributors rebuild the bundle locally with `npx gulp bundle` and commit build/ui-bundle.zip in their PR, so it rides in through the normal reviewed, checked path like any other change. CI now only: - on PRs: runs `npx gulp bundle` (lint + build) as the required `build` check, - on merge to main: pings Netlify so docs sites pull the committed bundle. No bot pushes to main, so no more protected-branch failures, no binary commits created by CI, and no token or org-ruleset change needed. Permissions drop to contents: read. The consumer URL (blob/main/build/ui-bundle.zip) is unchanged.
|
Address review feedback on tigergraph#54: - Fail a PR if src/ changed but build/ui-bundle.zip was not rebuilt, so a forgotten 'gulp bundle' cannot ship stale styling. Uses the PR file list, not a zip byte/content compare (timestamps and platform-dependent image minification make those unreliable). - Only upload the bundle artifact on PRs; the docs sites read the committed zip from main, so uploading on the main push was dead weight. The build step still runs on main as a post-merge smoke test.
|
Good calls, addressed both in the latest push.
|
The contributor now commits build/ui-bundle.zip in the PR, so the artifact just duplicated a file already in the branch. Reviewers can grab the zip from the PR branch, and the docs sites read the committed zip from main. Nothing consumed the artifact, so remove the step.
|
Went one further and dropped the artifact upload entirely. Since the bundle is committed in the PR, the artifact just duplicated a file already in the branch. Reviewers can grab the zip from the PR branch, and the docs read the committed zip from main. Nothing consumed it. |
The git diff approach failed on the shallow checkout with 'no merge base'. Query the PR's changed files from the API instead: exact, and needs no local history. Adds pull-requests: read for the token.
Why
The publish step added in #52 fails on every merge to
main. On each push it rebuildsbuild/ui-bundle.zipand pushes it directly tomainasgithub-actions[bot].mainis protected, so the push is rejected:Changes must be made through a pull request(org-level rule), andRequired status check "build" is expected(repo ruleset) — a direct push can never carry a passing check.You can see this on the #53 merge run: the bundle builds fine, then the push is declined and the job exits 1.
Trying to make the bot push to
mainwould need a PAT or a GitHub App token on the bypass list, plus loop guards. That is a lot of moving parts for a docs UI repo.What this does
Stop auto-committing the bundle. Contributors rebuild it locally and commit it in their PR, so it goes through the normal reviewed + checked path like any other file:
CI now only:
npx gulp bundle(lint + build) — this is the requiredbuildcheck,main: pings Netlify so the docs sites rebuild and pull the committed bundle.Result
main, so the protected-branch failures stop for good.main.permissionsdrop tocontents: read.blob/main/build/ui-bundle.zip?raw=true) is unchanged, so no docs-repo change is needed.Trade-off
CI cannot verify the committed bundle is fresh — the zip embeds file timestamps, so a CI rebuild never byte-matches a locally built one. If someone changes
src/but forgets to rebuild, the docs show stale styling until a fresh bundle is committed. Reviewers should check that asrc/change includes a rebuiltbuild/ui-bundle.zip.