Skip to content

feat: Demo mode with mock data for GitHub Pages#31

Closed
lupita-hom wants to merge 2 commits intomainfrom
feat/demo-mode
Closed

feat: Demo mode with mock data for GitHub Pages#31
lupita-hom wants to merge 2 commits intomainfrom
feat/demo-mode

Conversation

@lupita-hom
Copy link
Collaborator

Summary

Adds a demo mode that renders the full RunWatch UI with realistic mock data — no backend, no GitHub App, no webhooks needed. Deployed as a static site to GitHub Pages.

Live demo: https://homeles.github.io/RunWatch/ (after merge + Pages setup)

How It Works

Set REACT_APP_DEMO_MODE=true at build time to activate demo mode. The app:

  1. Swaps API layerapiService.js becomes a proxy that imports mockApiService (mock) or realApiService (production) based on the env var
  2. Swaps socket layer — same proxy pattern; mock socket is a no-op
  3. Uses HashRouter — GitHub Pages doesn't support SPA routing, so demo mode uses HashRouter instead of BrowserRouter
  4. Shows a DemoBanner — purple gradient bar at top with "DEMO" chip and link to install RunWatch

Mock Data

Generated deterministically (seeded PRNG) for consistency:

Count
Repositories 5 (acme-corp/web-platform, api-gateway, mobile-app, infra-terraform, data-pipeline)
Workflows 17 (CI, Deploy Production, E2E Tests, iOS/Android Build, Plan/Apply, etc.)
Runs ~100-150 across 7 days
Labels ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-14, self-hosted (linux/x64, macOS/arm64), gpu
Events push, pull_request, workflow_dispatch, schedule, release
Conclusions ~70% success, ~10% failure, ~5% cancelled, some in_progress & queued
Branches main, develop, feature/auth-v2, fix/memory-leak, release/v2.1, hotfix/cve-2026, etc.

Files Changed

  • New: mockData.js, mockApiService.js, mockSocketService.js, DemoBanner.jsx, deploy-demo.yml
  • Renamed: apiService.jsrealApiService.js, socketService.jsrealSocketService.js
  • Modified: apiService.js (now proxy), socketService.js (now proxy), App.js (conditional Router + DemoBanner)

Deployment

The deploy-demo.yml workflow:

  • Triggers on push to main (when client/ changes) or manual dispatch
  • Builds with REACT_APP_DEMO_MODE=true and PUBLIC_URL=/RunWatch
  • Deploys to GitHub Pages via actions/deploy-pages@v4

Setup Required After Merge

  1. Go to Settings → Pages in the repo
  2. Set Source to GitHub Actions
  3. The workflow will auto-deploy on next push to main

Production Impact

Zero — the proxy files only import mock modules when REACT_APP_DEMO_MODE=true. The Docker build and normal dev server don't set this var, so they get the real API/socket as before.

- Add REACT_APP_DEMO_MODE env var to switch between real and mock APIs
- Create comprehensive mock data: 5 repos, 17 workflows, ~150 runs
  with realistic labels (ubuntu-latest, windows-latest, macos-latest,
  self-hosted), events (push, pull_request, workflow_dispatch, schedule),
  branches, durations, and mixed success/failure/cancelled conclusions
- Mock API service mirrors all apiService methods with simulated latency
- Mock socket service (no-op) for demo mode
- Proxy pattern: apiService.js and socketService.js auto-switch
- HashRouter for GitHub Pages compatibility (BrowserRouter in production)
- DemoBanner component with link to install RunWatch
- GitHub Actions workflow: deploy-demo.yml builds and deploys to Pages
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 4 package(s) with unknown licenses.
See the Details below.

License Issues

.github/workflows/deploy-demo.yml

PackageVersionLicenseIssue Type
actions/checkout4.*.*NullUnknown License
actions/deploy-pages4.*.*NullUnknown License
actions/setup-node4.*.*NullUnknown License
actions/upload-pages-artifact3.*.*NullUnknown License
Denied Licenses: GPL-3.0, AGPL-3.0

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout 4.*.* 🟢 6
Details
CheckScoreReason
Maintained⚠️ 23 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Code-Review🟢 10all changesets reviewed
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection🟢 6branch protection is not maximal on development and all release branches
SAST🟢 8SAST tool detected but not run on all commits
actions/actions/deploy-pages 4.*.* 🟢 5.4
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Binary-Artifacts🟢 10no binaries found in the repo
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 6dependency not pinned by hash detected -- score normalized to 6
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Fuzzing⚠️ 0project is not fuzzed
SAST🟢 7SAST tool detected but not run on all commits
Branch-Protection⚠️ 1branch protection is not maximal on development and all release branches
actions/actions/setup-node 4.*.* 🟢 6.1
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 1013 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Binary-Artifacts🟢 9binaries present in source code
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ 1branch protection is not maximal on development and all release branches
SAST🟢 9SAST tool is not run on all commits -- score normalized to 9
actions/actions/upload-pages-artifact 3.*.* 🟢 5.3
Details
CheckScoreReason
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Code-Review🟢 8Found 8/9 approved changesets -- score normalized to 8
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies🟢 4dependency not pinned by hash detected -- score normalized to 4
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Branch-Protection🟢 8branch protection is not maximal on development and all release branches

Scanned Files

  • .github/workflows/deploy-demo.yml

Replace template literals in console.error calls with separate arguments
to avoid externally-controlled format string warnings.
@lupita-hom
Copy link
Collaborator Author

Closing — moving to a separate demo branch approach instead of merging demo code into main. See the new workflow.

@lupita-hom lupita-hom closed this Mar 4, 2026
@homeles homeles deleted the feat/demo-mode branch March 4, 2026 18:19
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