diff options
Diffstat (limited to 'src/pipeline')
| -rw-r--r-- | src/pipeline/publish.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/pipeline/publish.rs b/src/pipeline/publish.rs index 639d717..5d03a06 100644 --- a/src/pipeline/publish.rs +++ b/src/pipeline/publish.rs @@ -152,19 +152,21 @@ fn commit_release(ctx: &Ctx, collect: &Collect) -> Result<i64> { }; // I1: nothing publishes without an approval. A manual rebuild inherits the // approval of the release it rebuilds. - let approval_id = match (approval_id, ctx.build.kind.as_str()) { - (Some(a), _) => Some(a), - (None, "manual_rebuild") => ctx + let inherited = match ctx.build.kind.as_str() { + "manual_rebuild" => ctx .build .release_id .and_then(|rid| db::release_by_id(&ctx.db, rid).ok().flatten()) .and_then(|r| r.approval_id), - (None, other) => { - return Err(Error::fail_closed(format!( - "refusing to publish a {other} build with no approval behind it" - ))) - } + _ => None, }; + let approval_id = approval_id.or(inherited).ok_or_else(|| { + Error::fail_closed(format!( + "refusing to publish a {} build with no approval behind it", + ctx.build.kind + )) + })?; + let build_id = ctx.build.id.clone(); let packages = collect.packages.clone(); let names: Vec<String> = packages.iter().map(|p| p.name.clone()).collect(); |
