Skip to content

Commit 1fc2fe1

Browse files
committed
feat: filter GitHub Actions workflow commands from output
Hide ugly workflow commands (::debug::, ::group::, etc.) that are meant for the GitHub Actions runner, not humans. Now shows only actual action output with cleaner formatting: - Filters lines starting with :: - Indents action output for clarity - Shows errors in red Makes action execution much more readable!
1 parent 26f57e3 commit 1fc2fe1

1 file changed

Lines changed: 40 additions & 3 deletions

File tree

src/actions.rs

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,15 +399,52 @@ pub async fn execute_node_action(
399399

400400
let mut cmd = tokio::process::Command::new("node");
401401
cmd.arg(&main_file)
402-
.current_dir(action_dir);
402+
.current_dir(action_dir)
403+
.stdout(std::process::Stdio::piped())
404+
.stderr(std::process::Stdio::piped());
403405

404406
// Add all GitHub environment variables
405407
for (key, value) in github_env {
406408
cmd.env(key, value);
407409
}
408410

409-
let status = cmd
410-
.status()
411+
let mut child = cmd
412+
.spawn()
413+
.context(format!("Failed to execute Node.js action: {}", main))?;
414+
415+
// Filter and display output, removing GitHub Actions workflow commands
416+
let stdout = child.stdout.take().unwrap();
417+
let stderr = child.stderr.take().unwrap();
418+
419+
let stdout_task = tokio::spawn(async move {
420+
use tokio::io::{AsyncBufReadExt, BufReader};
421+
let reader = BufReader::new(stdout);
422+
let mut lines = reader.lines();
423+
while let Ok(Some(line)) = lines.next_line().await {
424+
// Filter out GitHub Actions workflow commands
425+
if !line.starts_with("::") {
426+
println!(" {}", line);
427+
}
428+
}
429+
});
430+
431+
let stderr_task = tokio::spawn(async move {
432+
use tokio::io::{AsyncBufReadExt, BufReader};
433+
let reader = BufReader::new(stderr);
434+
let mut lines = reader.lines();
435+
while let Ok(Some(line)) = lines.next_line().await {
436+
// Filter out GitHub Actions workflow commands
437+
if !line.starts_with("::") {
438+
eprintln!(" {}", line.red());
439+
}
440+
}
441+
});
442+
443+
// Wait for output tasks
444+
let _ = tokio::join!(stdout_task, stderr_task);
445+
446+
let status = child
447+
.wait()
411448
.await
412449
.context(format!("Failed to execute Node.js action: {}", main))?;
413450

0 commit comments

Comments
 (0)