Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Rusty-Actions

A rust translation of @actions/github.

GitHub Actions

Find the documentation here.

Crates.io Total Downloads

Supported features

  • get_input
  • set_output
  • get_context: Returns a hydrated context object
  • logging
    • debug
    • info
    • notice (with annotations)
    • warn (with annotations)
    • error (with annotations)
    • is_debug

Installation

cargo add actions-github

Latest version available is latest version

Usage

// Obtain the context from the action workeruse actions_github::context::get_context;use actions_github::core::set_output;use actions_github::logger;
logger::info("Obtaining context");let ctx = get_context().unwrap();
logger::debug_log(format!("Event is {}", ctx.event_name).as_str());// Produce an outputset_output("is_pr",(ctx.event_name == "pull_request").to_string());

Works well with octocrab:

use actions_github::core::{get_input, set_output};use actions_github::context::get_context;use octocrab::Octocrab;let token = get_input("GITHUB_TOKEN").unwrap();let crab = Octocrab::builder().personal_token(token).build();
octocrab::initialise(crab.unwrap());let context = get_context();let org = context.repo.owner;let repo = context.repo.repo;let pulls = octocrab::instance().pulls(owner, repo).list()// Output how many PRs are in the repository
set_output("PRs", pulls.len().to_string());

About

A rust translation of @actions/github

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages