diff --git a/lib/crates/fabro-cli/src/commands/pr/create.rs b/lib/crates/fabro-cli/src/commands/pr/create.rs index a2a0f1fdb..d83af35ae 100644 --- a/lib/crates/fabro-cli/src/commands/pr/create.rs +++ b/lib/crates/fabro-cli/src/commands/pr/create.rs @@ -131,9 +131,6 @@ async fn create_from( match record { Some(record) => { info!(pr_url = %record.html_url, "Pull request created"); - if let Err(err) = run_store.put_pull_request(&record).await { - tracing::warn!(error = %err, "Failed to persist pull request in run store"); - } if let Err(err) = record.save(&run_dir.join("pull_request.json")) { tracing::warn!(error = %err, "Failed to save pull_request.json"); } diff --git a/lib/crates/fabro-workflow/src/pipeline/pull_request.rs b/lib/crates/fabro-workflow/src/pipeline/pull_request.rs index 84b238ff7..b33f4d1c2 100644 --- a/lib/crates/fabro-workflow/src/pipeline/pull_request.rs +++ b/lib/crates/fabro-workflow/src/pipeline/pull_request.rs @@ -500,7 +500,7 @@ pub async fn maybe_open_pull_request( } } - Ok(Some(PullRequestRecord { + let record = PullRequestRecord { html_url: created.html_url, number: created.number, owner, @@ -508,7 +508,16 @@ pub async fn maybe_open_pull_request( base_branch: base_branch.to_string(), head_branch: head_branch.to_string(), title, - })) + }; + + if let Some(run_store) = run_store { + run_store + .put_pull_request(&record) + .await + .map_err(|err| format!("failed to persist pull request in run store: {err}"))?; + } + + Ok(Some(record)) } /// PULL_REQUEST phase: optionally create a pull request after finalize.