8 unstable releases (3 breaking)

0.4.3 Oct 21, 2022
0.4.2 Oct 21, 2022
0.3.0 Oct 19, 2022
0.2.1 Aug 25, 2022
0.1.0 Aug 9, 2022

#10 in #github-actions

MIT license

23KB
388 lines

GitHub Actions library written in Rust

Rust crates.io Documentation

This is a Rust GitHub Actions library which should help those of us that write GitHub Actions in Rust.

Usage

use ghactions::{info, debug, warn, error, group, groupend, errorf, setoutput};
use ghactions::reporef::RepositoryReference;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {

    let mut action = ghactions::init();

    if ! action.in_action() {
        error!("Failed to load action.yml file");
        return Err(Error);
    }

    info!("GitHub Action Name :: {}", &action.name.clone().unwrap_or_else(|| "N/A".to_string()));

    group!("Main Workflow");

    info!("Repository: `{}`", action.repository.display());

    let client = action.client?;

    // https://github.com/softprops/hubcaps/blob/master/examples/releases.rs
    let latest = client.repo(owner, repo).releases().latest().await?;
    info!("{:#?}", latest);

    for r in client.repo(owner, repo).releases().list().await? {
        info!("  -> {}", r.name);
    }

    groupend!();

    Ok(())
}

License

This code is under the MIT License.

Dependencies

~17–27MB
~617K SLoC