Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for make_latest in UpdateReleaseBuilder #646

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading