feat: Demo mode with mock data for GitHub Pages#31
Closed
lupita-hom wants to merge 2 commits intomainfrom
Closed
Conversation
- 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
Dependency ReviewThe following issues were found:
License Issues.github/workflows/deploy-demo.yml
OpenSSF Scorecard
Scanned Files
|
Replace template literals in console.error calls with separate arguments to avoid externally-controlled format string warnings.
Collaborator
Author
|
Closing — moving to a separate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=trueat build time to activate demo mode. The app:apiService.jsbecomes a proxy that importsmockApiService(mock) orrealApiService(production) based on the env varHashRouterinstead ofBrowserRouterMock Data
Generated deterministically (seeded PRNG) for consistency:
Files Changed
mockData.js,mockApiService.js,mockSocketService.js,DemoBanner.jsx,deploy-demo.ymlapiService.js→realApiService.js,socketService.js→realSocketService.jsapiService.js(now proxy),socketService.js(now proxy),App.js(conditional Router + DemoBanner)Deployment
The
deploy-demo.ymlworkflow:main(whenclient/changes) or manual dispatchREACT_APP_DEMO_MODE=trueandPUBLIC_URL=/RunWatchactions/deploy-pages@v4Setup Required After Merge
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.