Skip to content

Commit

Permalink
Add log line grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
pnehrer committed May 27, 2024
1 parent 29906d7 commit e11d79e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gha"
version = "0.1.3"
version = "0.1.4"
authors = ["Peter Nehrer <pnehrer@eclipticalsoftware.com>"]
repository = "https://github.com/ecliptical/gha"
description = """
Expand Down
18 changes: 18 additions & 0 deletions src/group.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! [Grouping log lines](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines)

/// Mark the start of the log line group.
pub fn start_group(title: &str) {
println!("::group::{title}");
}

/// Mark the end of the log line group.
pub fn end_group() {
println!("::endgroup::");
}

/// Perform arbitrary logic in the context of a log line group.
pub fn group<F: FnOnce() -> ()>(title: &str, f: F) {
start_group(title);
f();
end_group();
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
mod env;
mod file;
mod func;
mod group;
mod message;

pub use env::*;
pub use file::*;
pub use func::*;
pub use group::*;

0 comments on commit e11d79e

Please sign in to comment.