act
act copied to clipboard
Add support for Job Summaries
Act version
act version 0.2.26
Feature description
GitHub Actions recently added a feature called Job Summaries: https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/
When I use act to run a GitHub Action that implements Job Summaries, I get this error:
Error: Unable to find environment variable for $GITHUB_STEP_SUMMARY. Check if your runtime environment supports job summaries.
I assume it will require some development work for act to support this feature, so I am creating this feature request.
(If, on the contrary, there is a way to make this work simply by manipulating act command line params or some such thing, let me know!)
You could try running act --env GITHUB_STEP_SUMMARY=/var/run/act/summary
How would you expect act to output the markdown summary?
I guess this can be implemented like the existing GITHUB_ENV file command.
Using --env instead of -e (providing event path) works for me:
act --env GITHUB_STEP_SUMMARY=/var/run/act/summary
Haven't checked the output file but in my case I'm not interested in the summary output when running it with act. Just wanted to make sure I can run the same workflow without the need to comment out lines referencing the summary.
I'm not interested in the summary output when running it with act. Just wanted to make sure I can run the same workflow without the need to comment out lines referencing the summary.
Same here.
act --env GITHUB_STEP_SUMMARY=/var/run/act/summary
This does indeed seem to work 🍾 . Although the first time or two I tried it, I got an error about read/write permissions [1]....but now it's working fine, and I'm not sure what I might have done differently 🤷 .
At any rate, I will go ahead and close this feature request.
[1] In case anyone else runs across it, the error message was:
Error: Unable to access summary file: '/var/run/act/summary'. Check if the file has correct read/write permissions.
While workarounds exist (another one would be to check whether the environment variable is set by using something like if [ "$GITHUB_STEP_SUMMARY" != "" ]) I would prefer if this environment variable was provided by act by default.
I am getting this error again when I use --env GITHUB_STEP_SUMMARY=/var/run/act/summary:
Error: Unable to access summary file: '/var/run/act/summary'. Check if the file has correct read/write permissions.
Has anyone else seen this and gotten around it? Is there a way to....idk...pass file permissions into act?
I am getting this error again when I use
--env GITHUB_STEP_SUMMARY=/var/run/act/summary:Error: Unable to access summary file: '/var/run/act/summary'. Check if the file has correct read/write permissions.Has anyone else seen this and gotten around it? Is there a way to....idk...pass file permissions into
act?
@weineran Have you tried any other path you are able to write to? The path doesn't need to be this exact one, it just has to be a file where you have permission to write to!
I am getting this error again when I use
--env GITHUB_STEP_SUMMARY=/var/run/act/summary:Error: Unable to access summary file: '/var/run/act/summary'. Check if the file has correct read/write permissions.Has anyone else seen this and gotten around it? Is there a way to....idk...pass file permissions into
act?
You can write to almost anything in /dev thus you can just print back to the terminal (through act) by assigning the GITHUB_STEP_SUMMARY as /dev/stdout
Example:
--env GITHUB_STEP_SUMMARY=/dev/stdout
The default for act itself should probably just be this.
@weineran Have you tried any other path you are able to write to?
Yes, thanks for the suggestion and apologies for the delayed response. I've been using --env GITHUB_STEP_SUMMARY=/dev/stdout and it works nicely.
You can write to almost anything in /dev thus you can just print back to the terminal (through act) by assigning the GITHUB_STEP_SUMMARY as /dev/stdout The default for act itself should probably just be this
Agreed this should probably be the default. Or possibly /dev/null
Closing this issue again because I am happy with my current workaround.
I'd want act to handle both github_step_summary and github_output by providing environment variables that point to files. When a job completes, the former could be dumped to the log. I think I'd probably want the latter to be dumped to the log as well.
$GITHUB_STEP_SUMMARY was added in #1607