Skip to content

Automate staging deploys#108

Merged
BASIC-BIT merged 1 commit into
mainfrom
ci/automate-staging-deploy
May 30, 2026
Merged

Automate staging deploys#108
BASIC-BIT merged 1 commit into
mainfrom
ci/automate-staging-deploy

Conversation

@BASIC-BIT
Copy link
Copy Markdown
Owner

@BASIC-BIT BASIC-BIT commented May 30, 2026

What changed

  • Adds a Staging Deploy workflow that runs after successful Baseline Checks on main, plus manual dispatch.
  • Deploys Convex development functions first, then Vercel staging, then runs hosted @flow health against VRDEX_HOSTED_E2E_BASE_URL.
  • Gates the workflow on required repo settings and writes an explicit skip summary if any setting is missing.
  • Documents the staging automation and manual Convex fallback.

Current blocker

Repository secrets currently include CONVEX_DEPLOY_KEY_DEV, VERCEL_ORG_ID, VERCEL_PROJECT_ID, and VRDEX_HOSTED_E2E_BROWSER_TOKEN, but not VERCEL_TOKEN. Until VERCEL_TOKEN is added, the workflow will skip safely instead of partially deploying staging.

Testing

Risk

This introduces a post-main automation path, but it is gated fail-closed. When enabled, it will mutate the shared Convex dev deployment and Vercel staging environment only after main baseline checks pass.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vr-dex-web Ready Ready Preview, Comment May 30, 2026 11:29pm

Request Review

@github-actions
Copy link
Copy Markdown

Playwright Hosted Data-Flow

Outcome: success
Target: https://staging.vrdex.net
Run: https://github.com/BASIC-BIT/VRDex/actions/runs/26697796464
Artifact: playwright-hosted-data-flow

This optional check runs the mutation-backed profile flow against a configured hosted dev/staging target with isolated E2E test data.

@github-actions
Copy link
Copy Markdown

Playwright Data-Flow Preview

Outcome: success
Run: https://github.com/BASIC-BIT/VRDex/actions/runs/26697796464
Artifact: playwright-data-flow

Captured flow:

  • test-gated profile submission form
  • gated helper rejection without the Playwright token
  • Convex profile creation
  • submission success state
  • public profile page readback
  • discovery search readback

Artifacts include screenshots, traces, and recorded video for the flow run.

@github-actions
Copy link
Copy Markdown

Playwright Image Diff

Outcome: success
Run: https://github.com/BASIC-BIT/VRDex/actions/runs/26697796464
Artifact: playwright-image-diff

Changed screenshot baselines: none in this PR.

This check compares public route screenshots against committed baselines. Inline images show only added or modified baseline PNGs.

@github-actions
Copy link
Copy Markdown

Playwright Public Screenshot Preview

Outcome: success
Run: https://github.com/BASIC-BIT/VRDex/actions/runs/26697796464
Artifact: playwright-public-preview

Screenshots: all public route checks passed on desktop and mobile.

Full screenshot set is available in the artifact. Pixel diff baselines are handled by the separate Playwright Image Diff check.

@BASIC-BIT BASIC-BIT marked this pull request as ready for review May 30, 2026 23:33
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@BASIC-BIT BASIC-BIT merged commit f9c237e into main May 30, 2026
18 checks passed
@BASIC-BIT BASIC-BIT deleted the ci/automate-staging-deploy branch May 30, 2026 23:33
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR introduces a Staging Deploy GitHub Actions workflow that fires automatically after Baseline Checks succeeds on main (and supports manual dispatch), deploying Convex dev functions, then Vercel staging, then running hosted E2E health — with a fail-closed gate that skips gracefully when any required secret or variable is absent. Accompanying documentation in convex-environments.md and vercel-preview.md is updated to describe the automated flow and a manual fallback.

  • New workflow (.github/workflows/staging-deploy.yml): secrets gate → Convex deploy → Vercel staging deploy → Playwright hosted health → artifact upload; concurrency is serialized and non-cancellable.
  • Docs updated: both deployment docs now reference the workflow's required settings, skip behavior, and execution order; the manual PowerShell fallback is preserved.

Confidence Score: 4/5

Safe to merge; the workflow is fail-closed and the changes are limited to CI automation and documentation.

The workflow logic is sound — the gate, ordering of Convex-then-Vercel deploys, and artifact upload are all correct. The three gaps are: manual dispatch carries no branch guard so a non-main SHA could overwrite shared staging; the step summary is written before the health check so it can look successful even when E2E fails; and one GITHUB_OUTPUT line writes a URL via a bare echo rather than the newline-safe heredoc form. None of these block the advertised use case of automated post-main staging deploys.

.github/workflows/staging-deploy.yml deserves a second look for the three points above; the two documentation files are straightforward updates.

Important Files Changed

Filename Overview
.github/workflows/staging-deploy.yml New CI workflow that gates on secrets presence, then deploys Convex dev + Vercel staging + runs hosted E2E health; a few minor hardening gaps (manual dispatch branch, output injection, summary timing).
docs/deployment/convex-environments.md Documentation update describing the automated staging deploy and providing a manual fallback command; no functional changes.
docs/deployment/vercel-preview.md Documentation update listing required secrets/vars for the Staging Deploy workflow and describing its skip-safe behavior; no functional changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([workflow_run: Baseline Checks on main\nOR workflow_dispatch]) --> B{conclusion == success\nOR manual?}
    B -- No --> Z([Skip job])
    B -- Yes --> C[Checkout ref]
    C --> D[Check staging gate\nall 6 secrets/vars present?]
    D -- Missing --> E[Write skip summary\necho enabled=false\nexit 0]
    E --> Z
    D -- All present --> F[echo enabled=true\nSetup pnpm + Node.js\nInstall deps]
    F --> G[Deploy Convex dev functions\nCONVEX_DEPLOY_KEY_DEV]
    G --> H[Deploy Vercel staging\n--target=staging\ncapture deployment_url]
    H --> I[Write step summary\ndeploy URL + hosted health target]
    I --> J[Install Playwright Chromium]
    J --> K[Run pnpm test:e2e:hosted\nagainst VRDEX_HOSTED_E2E_BASE_URL]
    K --> L[Upload artifacts\nplaywright-report, test-results]
    L --> M([Done])
    K -- fail --> L
Loading
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
.github/workflows/staging-deploy.yml:11
**Manual dispatch can deploy non-main branches to shared staging**

`workflow_dispatch` carries no branch restriction, so anyone with Actions write access can trigger this from a feature branch and overwrite the shared Convex dev deployment and Vercel `staging` environment with unreviewed code. Since the concurrency group is always `staging-deploy-main`, a feature-branch manual run will also queue against (and potentially delay) the next automated main-branch staging update. Consider adding a branch check early in the job — e.g., refusing to proceed if `github.ref != 'refs/heads/main'` for non-emergency use, or at minimum noting the branch in the step summary so it is obvious when a non-main SHA was deployed.

### Issue 2 of 3
.github/workflows/staging-deploy.yml:63-64
**`GITHUB_OUTPUT` write is not injection-safe for multiline values**

Writing a variable value directly with `echo "key=$VALUE"` is flagged by GitHub's own hardening guide: if `HOSTED_BASE_URL` ever contains a literal newline or the string `%0A`, it would split into multiple output entries and silently break the health-check step. The recommended pattern is a heredoc delimiter, which is immune to embedded newlines.

```suggestion
          echo "enabled=true" >> "$GITHUB_OUTPUT"
          {
            echo "hosted_base_url<<EOF"
            echo "$HOSTED_BASE_URL"
            echo "EOF"
          } >> "$GITHUB_OUTPUT"
```

### Issue 3 of 3
.github/workflows/staging-deploy.yml:103-108
**Step summary written before E2E health check runs**

The step summary (including "Vercel staging deployment: URL") is appended inside the "Deploy Vercel staging" step, so it is visible even when the subsequent health check fails. A reader glancing at the summary will see a successful deployment URL without a clear indication that health validation did not pass. Consider deferring the full summary to a dedicated final step that runs `if: always() && steps.gate.outputs.enabled == 'true'` and emits a health outcome alongside the deploy URL, or at minimum adding a health result row after the health step.

Reviews (1): Last reviewed commit: "Add automated staging deploy workflow" | Re-trigger Greptile

- completed
branches:
- main
workflow_dispatch:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Manual dispatch can deploy non-main branches to shared staging

workflow_dispatch carries no branch restriction, so anyone with Actions write access can trigger this from a feature branch and overwrite the shared Convex dev deployment and Vercel staging environment with unreviewed code. Since the concurrency group is always staging-deploy-main, a feature-branch manual run will also queue against (and potentially delay) the next automated main-branch staging update. Consider adding a branch check early in the job — e.g., refusing to proceed if github.ref != 'refs/heads/main' for non-emergency use, or at minimum noting the branch in the step summary so it is obvious when a non-main SHA was deployed.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/staging-deploy.yml
Line: 11

Comment:
**Manual dispatch can deploy non-main branches to shared staging**

`workflow_dispatch` carries no branch restriction, so anyone with Actions write access can trigger this from a feature branch and overwrite the shared Convex dev deployment and Vercel `staging` environment with unreviewed code. Since the concurrency group is always `staging-deploy-main`, a feature-branch manual run will also queue against (and potentially delay) the next automated main-branch staging update. Consider adding a branch check early in the job — e.g., refusing to proceed if `github.ref != 'refs/heads/main'` for non-emergency use, or at minimum noting the branch in the step summary so it is obvious when a non-main SHA was deployed.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +63 to +64
echo "enabled=true" >> "$GITHUB_OUTPUT"
echo "hosted_base_url=$HOSTED_BASE_URL" >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 GITHUB_OUTPUT write is not injection-safe for multiline values

Writing a variable value directly with echo "key=$VALUE" is flagged by GitHub's own hardening guide: if HOSTED_BASE_URL ever contains a literal newline or the string %0A, it would split into multiple output entries and silently break the health-check step. The recommended pattern is a heredoc delimiter, which is immune to embedded newlines.

Suggested change
echo "enabled=true" >> "$GITHUB_OUTPUT"
echo "hosted_base_url=$HOSTED_BASE_URL" >> "$GITHUB_OUTPUT"
echo "enabled=true" >> "$GITHUB_OUTPUT"
{
echo "hosted_base_url<<EOF"
echo "$HOSTED_BASE_URL"
echo "EOF"
} >> "$GITHUB_OUTPUT"
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/staging-deploy.yml
Line: 63-64

Comment:
**`GITHUB_OUTPUT` write is not injection-safe for multiline values**

Writing a variable value directly with `echo "key=$VALUE"` is flagged by GitHub's own hardening guide: if `HOSTED_BASE_URL` ever contains a literal newline or the string `%0A`, it would split into multiple output entries and silently break the health-check step. The recommended pattern is a heredoc delimiter, which is immune to embedded newlines.

```suggestion
          echo "enabled=true" >> "$GITHUB_OUTPUT"
          {
            echo "hosted_base_url<<EOF"
            echo "$HOSTED_BASE_URL"
            echo "EOF"
          } >> "$GITHUB_OUTPUT"
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +103 to +108
{
echo "## Staging deploy"
echo "Convex development functions deployed."
echo "Vercel staging deployment: $deployment_url"
echo "Hosted health target: ${{ steps.gate.outputs.hosted_base_url }}"
} >> "$GITHUB_STEP_SUMMARY"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Step summary written before E2E health check runs

The step summary (including "Vercel staging deployment: URL") is appended inside the "Deploy Vercel staging" step, so it is visible even when the subsequent health check fails. A reader glancing at the summary will see a successful deployment URL without a clear indication that health validation did not pass. Consider deferring the full summary to a dedicated final step that runs if: always() && steps.gate.outputs.enabled == 'true' and emits a health outcome alongside the deploy URL, or at minimum adding a health result row after the health step.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/staging-deploy.yml
Line: 103-108

Comment:
**Step summary written before E2E health check runs**

The step summary (including "Vercel staging deployment: URL") is appended inside the "Deploy Vercel staging" step, so it is visible even when the subsequent health check fails. A reader glancing at the summary will see a successful deployment URL without a clear indication that health validation did not pass. Consider deferring the full summary to a dedicated final step that runs `if: always() && steps.gate.outputs.enabled == 'true'` and emits a health outcome alongside the deploy URL, or at minimum adding a health result row after the health step.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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