🪜 [src] watch whole repos persistently#274
Closed
chicks-net wants to merge 2 commits into
Closed
Conversation
Signed-off-by: Christopher Hicks <chicks.net@gmail.com>
Signed-off-by: Christopher Hicks <chicks.net@gmail.com>
| var duration string | ||
| if run.RunStartedAt != nil && !run.RunStartedAt.IsZero() { | ||
| if run.Status == "completed" && run.UpdatedAt != nil && !run.UpdatedAt.IsZero() { | ||
| duration = timing.FormatDuration(run.UpdatedAt.Time.Sub(run.RunStartedAt.Time)) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
QF1008: could remove embedded field "Time" from selector (staticcheck)
| var duration string | ||
| if run.RunStartedAt != nil && !run.RunStartedAt.IsZero() { | ||
| if run.Status == "completed" && run.UpdatedAt != nil && !run.UpdatedAt.IsZero() { | ||
| duration = timing.FormatDuration(run.UpdatedAt.Time.Sub(run.RunStartedAt.Time)) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
QF1008: could remove embedded field "Time" from selector (staticcheck)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds repository-wide workflow-run watching and persist-mode support to gh-observer, including configuration and README updates.
Changes:
- Adds
--repo/-rparsing, repo-watch mode, and repo-watch TUI/snapshot rendering. - Adds persist-mode state and refresh behavior to PR and Actions run watchers.
- Adds repo flag parsing, repo workflow-run fetching helpers, config defaults, and documentation.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents repo-wide monitoring, persist mode, and config. |
| main.go | Adds --repo, parsing, repo-watch dispatch, and snapshot output. |
| internal/tui/view.go | Shows persist-mode status in PR view. |
| internal/tui/update.go | Adds persist polling and new-commit reset handling. |
| internal/tui/runview.go | Shows persist-mode status in run view. |
| internal/tui/runupdate.go | Keeps run watcher alive in persist mode. |
| internal/tui/runmodel.go | Adds persist fields to run model. |
| internal/tui/repoview.go | Adds repo-watch TUI rendering. |
| internal/tui/repoupdate.go | Adds repo-watch TUI update/fetch loop. |
| internal/tui/repomodel.go | Adds repo-watch model state. |
| internal/tui/model.go | Adds persist fields to PR model. |
| internal/tui/messages.go | Adds repo-watch update message. |
| internal/github/runs.go | Adds repository workflow-run fetch and exit helpers. |
| internal/github/pr.go | Adds --repo value parsing. |
| internal/github/pr_test.go | Adds repo flag parser tests. |
| internal/config/config.go | Adds persist refresh interval config. |
| .config.example.yaml | Documents persist refresh interval and links setting. |
Comments suppressed due to low confidence (1)
internal/tui/repoview.go:129
- The repo-watch icon mapping omits
action_requiredfrom the failure cases, so those failed workflow runs render with the default neutral marker instead of a failure indicator. This is inconsistent with the exit-code logic that treatsaction_requiredas a failure.
case "failure", "timed_out":
return "✗"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+119
to
+122
| return m, tea.Batch( | ||
| fetchCheckRuns(m.ctx, m.token, m.owner, m.repo, m.prNumber), | ||
| tick(m.refreshInterval), | ||
| ) |
Comment on lines
+37
to
+41
| for { | ||
| runs, resp, err := client.Actions.ListRepositoryWorkflowRuns(ctx, owner, repo, opts) | ||
| if err != nil { | ||
| return nil, rateLimitRemaining, fmt.Errorf("failed to list repository workflow runs: %w", err) | ||
| } |
Comment on lines
+151
to
+157
| prNumber, _, _, err := ghclient.GetCurrentPRWithRepo() | ||
| if err != nil { | ||
| // No PR detected — watch the repo's workflow runs | ||
| return runArgs{mode: modeRepoWatch, owner: flagOwner, repo: flagRepo, persist: persist}, nil | ||
| } | ||
| // PR detected — use it with the flag's owner/repo | ||
| return runArgs{mode: modePR, owner: flagOwner, repo: flagRepo, prNumber: prNumber, persist: persist}, nil |
Comment on lines
+73
to
+77
| case "failure", "timed_out": | ||
| style = m.styles.Failure | ||
| case "cancelled", "skipped": | ||
| style = m.styles.Queued | ||
| default: |
Comment on lines
+89
to
+91
| // FailureRunConclusion returns true if the conclusion indicates a failed run. | ||
| func FailureRunConclusion(conclusion string) bool { | ||
| return conclusion == "failure" || conclusion == "timed_out" || conclusion == "action_required" |
Comment on lines
+38
to
+40
| name := run.DisplayTitle | ||
| if len(name) > 40 { | ||
| name = name[:37] + "..." |
Comment on lines
+461
to
+463
| name := run.DisplayTitle | ||
| if len(name) > 40 { | ||
| name = name[:37] + "..." |
Comment on lines
+86
to
+90
| styledIcon := style.Render(icon) | ||
| styledStatus := style.Render(status) | ||
| styledDuration := style.Render(duration) | ||
|
|
||
| fmt.Fprintf(&b, "%s %-40s %-10s %-10s %s\n", styledIcon, name, styledStatus, styledDuration, branch) |
Comment on lines
+100
to
+101
| if m.persist { | ||
| cmds = append(cmds, fetchPRInfo(m.ctx, m.token, m.owner, m.repo, m.prNumber)) |
| // fetchRepositoryRuns fetches recent workflow runs for the repository. | ||
| func fetchRepositoryRuns(ctx context.Context, token, owner, repo string) tea.Cmd { | ||
| return func() tea.Msg { | ||
| client, err := ghclient.NewClient(ctx) |
Member
Author
|
Failed attempt at #269 |
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.
Done
Meta
(Automated in
.just/gh-process.just.)