← Back to Pull requests

ci: show the Cloud Build website preview as a GitHub Deployment #4852

Open
unknown opened this pull request with 385 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 14, 2026 23:50 UTC
Author

What type of PR is this?

/kind feature

What this PR does / Why we need it:

This is phase 1 of #4850: a first step towards replacing agones-bot with a GitHub Action, and useful
on its own.

It adds a Cloud Build complete workflow (.github/workflows/cloud_build_complete.yaml). The
workflow runs when the Cloud Build PR build check (agones-dev-pull-request-build) completes. It is
named for the trigger rather than this first job, so the PR comment from phase 2 can be added as
another job without renaming anything.

Its website-preview job runs build/scripts/cloud-build-complete, a small Go program with its own
module that uses go-github. The program:

1. Reads the build ID from the check run's summary (Build <id> successful|failed).
2. Downloads the public build log from gs://agones-build-logs, retrying while it becomes available.
3. Looks in the log for the deploy-site-static step's Deployed service [preview] to [<url>] line.
4. If the preview was deployed, it creates a transient website-preview Deployment on the PR's head
commit, with a success status whose environment_url is the preview and whose log_url is the
Cloud Build page. That way the preview shows on the PR, including for failed builds that got as
far as deploying it.
5. If the preview wasn't deployed, it adds a notice and a job summary to the workflow run instead.

It needs no Google Cloud credentials, only contents: read and deployments: write on
GITHUB_TOKEN.

Which issue(s) this PR fixes:

Work on #4850

Did you use AI tools in preparing this PR?:

Y.

Special notes for your reviewer:

  • This can only be fully tested once it's on main. check_run workflows only run from the

  • default branch. Merging this answers the two open questions in #4850: whether check_run fires for
    the Cloud Build app's check runs, and whether a Deployment on a fork PR's head SHA is accepted and
    shows on the PR. If either fails, the run's job log will show where. A failure here never affects
    PR checks, because the workflow's own result is attached to main's head commit.
  • Why the URL comes from the log: it isn't enough to build the preview URL from the SHA and check

  • that it loads, because App Engine returns 200 for versions that don't exist.
  • Deployment settings:

  • - auto_merge: false stops GitHub merging main into the ref.
    - required_contexts: [] skips waiting on the commit's other checks.
    - transient_environment: true stops each new deployment marking other PRs' previews inactive.
    - If a website-preview deployment already exists for the SHA, the job skips it, so rebuilds
    don't create duplicates.
  • Safety: the workflow checks out main with a sparse checkout of just the program, and never

  • checks out or runs PR code.
  • Tests: the program has unit tests against trimmed real build logs, using a local fake of the

  • GitHub API. make test-build-scripts runs them, and make lint lints the module, like the other
    build scripts. make -C build lint test-build-scripts passes.

    Diff: 385 lines (+288 / -97) across 4 files Reviewer: markmandel Review duration: 3802m
    All Vouch review confidence checks passed
    Residual risk 0.39 = Change Risk (0.66) × (1 − Review Confidence (0.40)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.66 · 385 lines diff across 4 files
    0.66
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.356
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.066
    Real PR Conversation Timeline
    1 comments
    "Review active on #4852"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 40.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 66.2% (HIGH) · Higher = larger blast radius
    66.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.5% · Lower = rushed or shallow review
    40.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 39.4% · Moderate risk
    39.4%