feat(desktop): Workflow dispatch inputs & real-time action logs#75
feat(desktop): Workflow dispatch inputs & real-time action logs#75
Conversation
- YAMLパースでworkflow_dispatch inputsを抽出(choice/boolean/string/number対応) - dispatch APIにinputsパラメータを送信 - WorkflowRunCardにView logsボタンを追加し既存ActionLogsPaneでログ表示 - Configure/Runボタンを横並びレイアウトに改善
ActionLogsPaneStateにrunIdを追加し、workflow dispatchから開いた場合は getWorkflowRunJobsを3秒ポーリングしてjobリストを動的に更新する。 途中でjobが増えるワークフローでも再オープン不要になる。
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 4 minutes and 2 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughこのPRは、GitHub Actionsワークフロー実行機能を拡張します。YAMLベースのワークフローディスパッチ入力解析、ワークフロー実行ジョブの監視機能、UI制御の追加により、ワークフロー入力の設定とジョブ状態追跡を実現します。 Changes
Sequence Diagram(s)sequenceDiagram
participant User as ユーザー
participant UI as UI (RepositoryPanel)
participant Store as タブストア
participant TRPC as TRPC (サーバ)
participant GHA as GitHub API
User->>UI: ワークフロー入力を設定し実行
UI->>TRPC: dispatchGitHubWorkflow (inputs付き)
TRPC->>GHA: POST /dispatches (入力フォームデータ)
GHA-->>TRPC: ワークフロー実行ID返却
User->>UI: "View logs" をクリック
UI->>TRPC: getWorkflowRunJobs (runId)
TRPC->>GHA: GET /runs/{runId}/jobs
GHA-->>TRPC: ジョブリスト返却
TRPC-->>UI: マップ済みジョブ (status, detailsUrl)
UI->>Store: addActionLogsTab (runId付き)
Store-->>UI: ActionLogsPane (runId設定)
UI->>TRPC: ポーリング: getWorkflowRunJobs (runId)
TRPC->>GHA: GET /runs/{runId}/jobs
GHA-->>TRPC: 更新ジョブ状態
TRPC-->>UI: ジョブ状態更新
Note over UI: すべてのジョブが終了時<br/>ポーリング停止
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ActionLogsPane/ActionLogsPane.tsx (1)
368-416:⚠️ Potential issue | 🟠 Majorworkflow run 表示では PR チェック再実行ボタンを無効化してください。
runIdモードでもJobSteps側は既存のrerunPullRequestChecksmutation をそのまま使うので、この pane でRe-run failed/allを押すと表示中の workflow run ではなく現在の PR checks を再実行してしまいます。runIdがある場合はこの UI を隠すか、workflow run 用の再実行 API に切り替える必要があります。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ActionLogsPane/ActionLogsPane.tsx` around lines 368 - 416, The pane currently shows "Re-run failed/all" even when viewing a workflow run (runId present) which triggers rerunPullRequestChecks against PR checks; update ActionLogsPane to hide or disable those buttons when runId is truthy by conditioning the UI rendering on the runId variable (e.g., wrap the Re-run controls in a check like if (!runId) ...), and ensure JobSteps is not passed or invoking the rerunPullRequestChecks mutation when runId exists; alternatively, if you prefer to support workflow-run reruns, replace the PR mutation call with the workflow-run rerun API and wire that through JobSteps when runId is present (refer to ActionLogsPane, runId, JobSteps, and rerunPullRequestChecks to locate the changes).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.ts`:
- Around line 280-337: The code currently returns noDispatch in the catch block
which hides workflows that were already detected as having workflow_dispatch;
instead preserve dispatch support on parse failures by returning {
supportsDispatch: true, inputs: [] } when hasDispatch is true. Concretely:
ensure hasDispatch is determined outside/above the try/catch (or capture it
before throwing), catch yaml.load or parsing errors and if hasDispatch return {
supportsDispatch: true, inputs: [] } otherwise return noDispatch; update the
catch handling around yaml.load/readFileSync and adjust references to
hasDispatch, yaml.load, noDispatch, supportsDispatch and inputs accordingly.
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/RepositoryPanel/RepositoryPanel.tsx`:
- Around line 580-598: handleRunWorkflow が空文字で初期化された未入力値(input.default ??
"")をそのまま送ってしまっているので、送信前に必須項目の検証を行い、空文字の値は payload から削除してください:
dispatchWorkflowMutation に渡す前に inputs オブジェクトを走査し、値が ""
のキーは削除、必須(required)フィールドが存在していて値が空または未設定ならユーザー向けのエラーを返す(またはセットし直す)ようにし、結果として
mutateAsync に渡す inputs は空文字を含まないものにしてください(参照箇所: handleRunWorkflow,
dispatchWorkflowMutation.mutateAsync, workflowRef)。また同様の修正を 1226-1231
の同処理にも適用してください。
- Around line 361-366: 現在の単一の workflowInputValues state を workflow ごとに分離してください:
workflowInputValues と setWorkflowInputValues を Record<workflowId,
Record<string,string>>(例: Record<number,
Record<string,string>>)に変更し、expandedWorkflowId / setExpandedWorkflowId のまま各
workflow の入力を workflowId キーで保存・取得するように修正してください。具体的には RepositoryPanel コンポーネント内の
workflowInputValues/setWorkflowInputValues の型と初期値をマップ型に変更し、Run
ボタンや入力ハンドラが参照する箇所(既存の workflowInputValues を読み書きしている箇所および expand/selected
workflow ロジック)を workflowId をキーにした読み書きに置き換えて、別 workflow の値が流用されないようにしてください。
- Around line 624-643: handleViewWorkflowLogs currently returns early when
jobs.length === 0 which prevents opening the Action Logs tab for runs that have
no jobs yet; instead, remove the early return so the function always calls
addActionLogsTab(workspaceId, jobs, failedIdx >= 0 ? failedIdx : undefined,
runId) even when jobs is an empty array, and optionally replace the toast.error
with a non-blocking info toast (or no toast) so the tab opens and the existing
runId polling can populate jobs as they appear; ensure addActionLogsTab and any
downstream consumers correctly accept an empty jobs array and undefined failed
index.
---
Outside diff comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ActionLogsPane/ActionLogsPane.tsx`:
- Around line 368-416: The pane currently shows "Re-run failed/all" even when
viewing a workflow run (runId present) which triggers rerunPullRequestChecks
against PR checks; update ActionLogsPane to hide or disable those buttons when
runId is truthy by conditioning the UI rendering on the runId variable (e.g.,
wrap the Re-run controls in a check like if (!runId) ...), and ensure JobSteps
is not passed or invoking the rerunPullRequestChecks mutation when runId exists;
alternatively, if you prefer to support workflow-run reruns, replace the PR
mutation call with the workflow-run rerun API and wire that through JobSteps
when runId is present (refer to ActionLogsPane, runId, JobSteps, and
rerunPullRequestChecks to locate the changes).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0ed18b8e-e79f-407a-a349-6f8a4be2482b
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
apps/desktop/package.jsonapps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ActionLogsPane/ActionLogsPane.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/RepositoryPanel/RepositoryPanel.tsxapps/desktop/src/renderer/stores/tabs/store.tsapps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/renderer/stores/tabs/utils.tsapps/desktop/src/shared/tabs-types.ts
- YAMLパース失敗時もsupportsDispatch: trueを返すよう修正 - workflowInputValuesをworkflow IDごとに分離し値の混在を防止 - 必須入力の検証と空文字値の除去を追加 - jobs空配列でもActionLogsタブを開きポーリングに委ねる - runIdモード時にRe-runボタンを非表示にする
Summary
Test plan
Summary by CodeRabbit
リリースノート