2 releases

0.0.3 Aug 1, 2022
0.0.2 Aug 1, 2022

#56 in #github-actions

MIT license

10KB
158 lines

GitHub Actions library written in Rust

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

Installing

Cargo.toml

[dependencies]
gh_actions = "0.0.2"

Usage

use gh_actions::GHAction;

fn main() {
let action = GHAction::new();

if action.in_action() {
    // Name of your the Action
    let action_name = action.name.unwrap()

    println!(action_name)

    // github.com or Enterprise Server
    let api_url = action.get("api_url")
        .unwrap();

    // Get Actions Input
    let username = action.get_input("username")
        .unwrap();

    // Using the Hubcaps client
    let client = action.client
        .unwrap();

    let repo = client.repo("GeekMasher", "gh_actions");

}

Note: Do not use .unwrap() in a production Action.

License

This code is under the MIT License.

Dependencies

~17–30MB
~571K SLoC