[GH-ISSUE #1533] Add support for >> $GITHUB_STEP_SUMMARY #776

Closed
opened 2026-03-01 21:46:15 +03:00 by kerem · 5 comments
Owner

Originally created by @jontze on GitHub (Dec 22, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1533

Act version

0.2.34

Feature description

With the usage of $GITHUB_STEP_SUMMARY in workflows it's possible to generate markdown files as a summary of a job like this:

echo "{markdown content}" >> $GITHUB_STEP_SUMMARY

The usage is pretty similar to $GITHUB_ENV or $GITHUB_OUTPUT.
Ref.: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary

However, act fails on this point, because the $GITHUB_STEP_SUMMARY variable is not set:

/var/run/act/workflow/3: line 14: $GITHUB_STEP_SUMMARY: ambiguous redirect

I don't think that act should actually generate a markdown file as well, IMO it's enough to just ensure that the workflow doesn't fail if the syntax is used.

Thanks for the cool project ❤️

Originally created by @jontze on GitHub (Dec 22, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1533 ### Act version 0.2.34 ### Feature description With the usage of `$GITHUB_STEP_SUMMARY` in workflows it's possible to generate markdown files as a summary of a job like this: ```bash echo "{markdown content}" >> $GITHUB_STEP_SUMMARY ``` The usage is pretty similar to `$GITHUB_ENV` or `$GITHUB_OUTPUT`. Ref.: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary However, act fails on this point, because the `$GITHUB_STEP_SUMMARY` variable is not set: ```txt /var/run/act/workflow/3: line 14: $GITHUB_STEP_SUMMARY: ambiguous redirect ``` I don't think that `act` should actually generate a markdown file as well, IMO it's enough to just ensure that the workflow doesn't fail if the syntax is used. Thanks for the cool project :heart:
kerem 2026-03-01 21:46:15 +03:00
Author
Owner

@mottet commented on GitHub (Jan 18, 2023):

Looks like $GITHUB_STEP_SUMMARY is unset so the redirection points to nothing and fails.

I use a workaround to have the summary working in Github Action and not crashing in Act :

[ -w "$GITHUB_STEP_SUMMARY" ] && echo "{markdown content}" >> $GITHUB_STEP_SUMMARY

With the -w I check if $GITHUB_STEP_SUMMARY value is the path to a writable file and only if it is true the right part of && whould be executed.

I think manually setting the value $GITHUB_STEP_SUMMARY could also work but I didn't tried.

<!-- gh-comment-id:1387107800 --> @mottet commented on GitHub (Jan 18, 2023): Looks like `$GITHUB_STEP_SUMMARY` is unset so the redirection points to nothing and fails. I use a workaround to have the summary working in Github Action and not crashing in Act : ``` sh [ -w "$GITHUB_STEP_SUMMARY" ] && echo "{markdown content}" >> $GITHUB_STEP_SUMMARY ``` With the `-w` I check if `$GITHUB_STEP_SUMMARY` value is the path to a writable file and only if it is true the right part of `&&` whould be executed. I think manually setting the value `$GITHUB_STEP_SUMMARY` could also work but I didn't tried.
Author
Owner

@shubhbapna commented on GitHub (Feb 2, 2023):

You should be able to simply set this using the env flag. This way you will have control as to where you want the summary to be written to. For eg:

# when you just want your workflow to run without crashing and you don't care about the summary
act push --env GITHUB_STEP_SUMMARY="/dev/null"

# when you want to see whats being written
act push --env GITHUB_STEP_SUMMARY="/dev/stdout"
<!-- gh-comment-id:1414381384 --> @shubhbapna commented on GitHub (Feb 2, 2023): You should be able to simply set this using the env flag. This way you will have control as to where you want the summary to be written to. For eg: ``` # when you just want your workflow to run without crashing and you don't care about the summary act push --env GITHUB_STEP_SUMMARY="/dev/null" # when you want to see whats being written act push --env GITHUB_STEP_SUMMARY="/dev/stdout" ```
Author
Owner

@sarthak77 commented on GitHub (Apr 26, 2023):

What is the fix for this? I'm still getting the same error. Should we explicitly set the $GITHUB_STEP_SUMMARY variable?

<!-- gh-comment-id:1522660036 --> @sarthak77 commented on GitHub (Apr 26, 2023): What is the fix for this? I'm still getting the same error. Should we explicitly set the `$GITHUB_STEP_SUMMARY` variable?
Author
Owner

@sarthak77 commented on GitHub (May 2, 2023):

What is the fix for this? I'm still getting the same error. Should we explicitly set the $GITHUB_STEP_SUMMARY variable?

@catthehacker @cplee can you respond on this?

<!-- gh-comment-id:1530819151 --> @sarthak77 commented on GitHub (May 2, 2023): > What is the fix for this? I'm still getting the same error. Should we explicitly set the $GITHUB_STEP_SUMMARY variable? @catthehacker @cplee can you respond on this?
Author
Owner

@jsoref commented on GitHub (Apr 4, 2024):

If you run with act -r , then you can use something like:

(act_docker_pid=$(docker ps|perl -ne 'next unless s{\s.*"tail -f /dev/null".*act-.*}{};print'|tail -1); docker exec $act_docker_pid cat /var/run/act/workflow/SUMMARY.md; do
cker rm -f $act_docker_pid)
<!-- gh-comment-id:2038170159 --> @jsoref commented on GitHub (Apr 4, 2024): If you run with `act -r` , then you can use something like: ```sh (act_docker_pid=$(docker ps|perl -ne 'next unless s{\s.*"tail -f /dev/null".*act-.*}{};print'|tail -1); docker exec $act_docker_pid cat /var/run/act/workflow/SUMMARY.md; do cker rm -f $act_docker_pid) ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#776
No description provided.