Expand description
This is a Rust GitHub Actions library which should help those of us that write GitHub Actions in Rust.
§📦 Install
Run the following command to add the library to your Cargo.toml file:
cargo add ghactions
§📚 Features
- Easy to use
- Generate
action.ymlfile automatically from code - Validate GitHub Actions files
- Automatical input and output parsing
- Octocrab support
§🚀 Usage
Here is a simple example of how to use the library:
use ghactions::prelude::*;
#[derive(Actions, Debug, Clone)]
#[action(
name = "My Action",
description = "My Action Description",
)]
struct MyAction {
/// My Input
#[input()]
mode: bool,
// Output called `version`
#[output()]
version: String,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialise the Action
let action = MyAction::init()?;
info!("Action :: {:?}", action);
group!("Main Workflow");
info!("My Input Mode :: `{}`", action.mode);
info!("My Output Version :: `{}`", action.version);
groupend!();
Ok(())
}§Using Octocrab
use ghactions::prelude::*;
#[derive(Actions, Debug, Clone)]
struct MyAction {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let action = MyAction::init()?;
group!("Octocrab");
let octocrab = action.octocrab()?;
// ... Do something...
Ok(())
}§🦸 Support
Please create GitHub Issues if there are bugs or feature requests.
This project uses Semantic Versioning (v2) and with major releases, breaking changes will occur.
§📓 License
This project is licensed under the terms of the MIT open source license. Please refer to MIT for the full terms.
Modules§
- Prelude module to re-export the most commonly used types
Macros§
- Error for files (including line and column numbers)
- Group Macros
- End Group Macros
- Sets the output of the Actions which can be used in subsequent Actions.
Enums§
- Actions Error
Traits§
- Action Trait
Functions§
- Initialise and create a
env_logger::Builderwhich follows the GitHub Actions logging syntax.
Derive Macros§
- Derive macro for GitHub Actions