Skip to content

Commit

Permalink
Added support for make_latest in UpdateReleaseBuilder (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranger-ross authored Jun 11, 2024
1 parent 0aef32a commit cb55393
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/api/repos/releases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ pub struct UpdateReleaseBuilder<'octo, 'repos, 'handler, 'tag_name, 'target_comm
draft: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
prerelease: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
make_latest: Option<MakeLatest>,
}

impl<'octo, 'repos, 'handler, 'tag_name, 'target_commitish, 'name, 'body>
Expand All @@ -418,6 +420,7 @@ impl<'octo, 'repos, 'handler, 'tag_name, 'target_commitish, 'name, 'body>
body: None,
draft: None,
prerelease: None,
make_latest: None,
}
}

Expand Down Expand Up @@ -463,6 +466,14 @@ impl<'octo, 'repos, 'handler, 'tag_name, 'target_commitish, 'name, 'body>
self
}

/// Specifies whether this release should be set as the latest release for the repository.
/// Drafts and prereleases cannot be set as latest.
/// [`MakeLatest::Legacy`] specifies that the latest release should be determined based on the release creation date and higher semantic version.
pub fn make_latest(mut self, make_latest: MakeLatest) -> Self {
self.make_latest = Some(make_latest);
self
}

/// Sends the actual request.
pub async fn send(self) -> crate::Result<crate::models::repos::Release> {
let route = format!(
Expand Down

0 comments on commit cb55393

Please sign in to comment.