Skip to content

Add a CI Runs sidebar panel — latest GitHub Actions status per repo#50

Merged
falkoro merged 1 commit into
masterfrom
feat/gh-ci-runs-panel
Jun 6, 2026
Merged

Add a CI Runs sidebar panel — latest GitHub Actions status per repo#50
falkoro merged 1 commit into
masterfrom
feat/gh-ci-runs-panel

Conversation

@falkoro
Copy link
Copy Markdown
Owner

@falkoro falkoro commented Jun 6, 2026

What

Adds an optional CI Runs sidebar panel that shows the latest GitHub Actions workflow-run status for each configured repo — branch, run #, conclusion badge, relative time, and a link to the run. Mirrors the existing Remote Hosts panel end-to-end.

This is Phase 0 of the ShellDeck → self-serve SaaS plan (docs/shelldeck-saas-plan.md), the safest, fully self-contained piece — it touches only ShellDeck's own dashboard.

How it works

  • New src/gh_runs.rs — GETs …/actions/runs?per_page=1&exclude_pull_requests=true per repo via the shared reqwest client, with a 55s in-memory cache + last-good fallback so a transient GitHub error never blanks the panel. Surfaces X-RateLimit-Remaining/Reset.
  • ConfigDASHBOARD_GH_REPOS (owner/repo;owner2/repo2, deduped, cap 8) and DASHBOARD_GH_TOKEN.
  • RouteGET /api/gh-runs behind the same allowed + signed_in guard as the other panels.
  • UI — off by default; enable via Configure (panels.ciRuns). Status badge: queued/in_progress = amber-pulse, success = green, failure = red, else muted.

Security

The GitHub token is env-only: it is never included in any Serialize struct, never written to dashboard-config.json (or any store), and never logged (a redaction regex already strips Bearer from logs). Verified by grep across all touched files and by inspecting the live /api/gh-runs JSON.

Verification

  • cargo build --release ✅ · bun run build:frontend ✅ · cargo test 34 passed ✅
  • Ran a throwaway instance against two live repos (falkoro/shelldeck, spot-techno/spot-suite) — panel renders correctly, both runs show real status, zero console errors, token absent from the API response.

🤖 Generated with Claude Code

New src/gh_runs.rs polls the GitHub Actions API for the newest workflow
run per configured repo and surfaces it in an optional sidebar panel,
mirroring the Remote Hosts panel end-to-end (cache + last-good fallback +
rate-limit display).

- Config: DASHBOARD_GH_REPOS (owner/repo;... cap 8, deduped) and
  DASHBOARD_GH_TOKEN. The token is env-only: never serialized into the
  /api/gh-runs response, never written to a *.json store, never logged.
- Route: GET /api/gh-runs behind the same allowed+signed_in guard as the
  other panels. 55s in-memory cache to stay within GitHub rate limits.
- Panel: off by default; enable via Configure (panels.ciRuns). Renders
  status badge (queued/in_progress amber-pulse, success green, failure
  red), branch tag, run #, relative time, link to the run.
- Also drops in docs/shelldeck-saas-plan.md (the ultracode-designed
  4-phase plan; this panel is Phase 0).

Verified: cargo build --release + bun build green, cargo test 34 passed,
screenshot-checked the rendered panel against two live repos with zero
console errors, confirmed the token never appears in the API response.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings June 6, 2026 09:10
@falkoro falkoro merged commit 28536d1 into master Jun 6, 2026
@falkoro falkoro deleted the feat/gh-ci-runs-panel branch June 6, 2026 09:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new optional “CI Runs” sidebar widget that polls a new backend endpoint to show the latest GitHub Actions workflow run per configured repo, including caching/fallback behavior and UI configuration support.

Changes:

  • Backend: add /api/gh-runs plus src/gh_runs.rs to fetch latest workflow-run status per repo with in-memory caching and last-good fallback.
  • Configuration: introduce DASHBOARD_GH_REPOS + DASHBOARD_GH_TOKEN and a new UI panel toggle panels.ciRuns (default off).
  • Frontend: render the new panel, poll it on an interval, and style CI status badges/cards.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/settings.rs Adds ciRuns to persisted dashboard panel settings + parsing/tests.
src/routes.rs Registers /api/gh-runs route and handler behind existing guard.
src/pages.rs Injects the new “CI Runs” panel HTML into the sidebar template.
src/main.rs Adds gh_runs_cache to app state and wires the new module.
src/gh_runs.rs New module: fetch latest GitHub Actions runs per repo with cache + last-good fallback.
src/config.rs Adds env parsing for DASHBOARD_GH_REPOS + optional DASHBOARD_GH_TOKEN (+ tests).
public/metrics.js Implements CI runs polling/rendering in served JS output.
public/events.js Adds initial + interval calls to loadGhRuns() in served JS output.
public/core.js Extends default dashboardSettings.panels with ciRuns in served JS output.
public/app.css Adds styling for CI run cards and status badges.
public/actions.js Adds Configure UI checkbox + applies ciRuns visibility in served JS output.
frontend/metrics.ts Implements CI runs polling/rendering (TS source).
frontend/events.ts Adds initial + interval calls to loadGhRuns() (TS source).
frontend/core.ts Extends panel settings types/defaults with ciRuns (TS source).
frontend/actions.ts Adds Configure UI checkbox + applies ciRuns visibility (TS source).
docs/shelldeck-saas-plan.md Adds Phase 0 SaaS plan doc including CI-runs monitor scope.
.env.example Documents new GH env vars for the CI Runs panel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .env.example
Comment on lines +69 to +70
# Configure after setting repos. Unauthenticated GitHub API calls are limited to 60 req/hr,
# so set DASHBOARD_GH_TOKEN for more than ~1-2 repos or frequent dashboard use.
Comment thread src/gh_runs.rs
Comment on lines +86 to +90
pub async fn fetch_all(
config: Arc<Config>,
client: reqwest::Client,
cache: Arc<Mutex<Option<GhRunsCache>>>,
) -> GhRunsResult {
Comment thread src/pages.rs
Comment on lines +85 to +88
.replace(
r#"</div></section><section class="panel unlock-panel""#,
&format!(r#"</div></section>{}<section class="panel unlock-panel""#, ci_runs_panel),
)
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