Skip to content

Status

The outcome of a CI job or step.

use helpers4::ci::Status;

Cargo feature ci (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features ci

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.6", default-features = false, features = ["ci"] }
pub enum Status {
    /// Finished without errors.
    Success,
    /// Finished with an error, or timed out.
    Failure,
    /// Stopped before it finished.
    Cancelled,
    /// Not run.
    Skipped,
    /// Queued or still running.
    Pending,
}
use helpers4::ci::Status;

assert_eq!(Status::from_conclusion("failure"), Some(Status::Failure));
assert_eq!(Status::Success.icon(), "\u{2705}");
assert_eq!(Status::Success.label(), "success");
pub fn from_conclusion(conclusion: &str) -> Option<Self>

Reads the conclusion names CI services use, ignoring case.

success, passed and pass are Status::Success; failure, failed, error and timed_out are Status::Failure; cancelled and canceled are Status::Cancelled; skipped is Status::Skipped; pending, queued, in_progress and running are Status::Pending.

Parameters

ParameterTypeDescription
conclusion&strThe name, such as "success" or "cancelled".

Returns

Option<Self> — The status, or None for a name that is not one of those.

pub fn icon(self) -> &'static str

An emoji for the status, for a report or a PR comment.

Returns

&'static str\u{2705} for success, \u{274c} for failure, \u{1f6ab} for cancelled, \u{23ed}\u{fe0f} for skipped and \u{23f3} for pending.

pub fn label(self) -> &'static str

The lower-case name of the status.

Returns

&'static str"success", "failure", "cancelled", "skipped" or "pending".

src/ci/status.rs