Skip to content

Commit

Permalink
Add conclusion, completed_at and output fields to create check api
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkerens committed Oct 9, 2023
1 parent 2da2259 commit 258e540
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/api/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ pub struct CreateCheckRunBuilder<'octo, 'r> {
external_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
status: Option<CheckRunStatus>,
#[serde(skip_serializing_if = "Option::is_none")]
conclusion: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
completed_at: Option<DateTime<Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
output: Option<serde_json::Value>,
}

impl<'octo, 'r> CreateCheckRunBuilder<'octo, 'r> {
Expand All @@ -43,6 +49,9 @@ impl<'octo, 'r> CreateCheckRunBuilder<'octo, 'r> {
details_url: None,
external_id: None,
status: None,
conclusion: None,
completed_at: None,
output: None,
}
}

Expand All @@ -66,6 +75,28 @@ impl<'octo, 'r> CreateCheckRunBuilder<'octo, 'r> {
self
}

/// The final conclusion of the check.
/// Can be one of `success`, `failure`, `neutral`, `cancelled`, `timed_out`,
/// `skipped`, `stale` or `action_required`.
pub fn conclusion(mut self, conclusion: impl Into<String>) -> Self {
self.conclusion = Some(conclusion.into());
self
}

/// The time that the check run completed.
pub fn completed_at(mut self, completed_at: DateTime<Utc>) -> Self {
self.completed_at = Some(completed_at);
self
}

/// Check runs can accept a variety of data in the output object,
/// including a title and summary and can optionally provide
/// descriptive details about the run.
pub fn output(mut self, output: serde_json::Value) -> Self {
self.output = Some(output);
self
}

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

0 comments on commit 258e540

Please sign in to comment.