Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Job Summaries #1187

Closed
weineran opened this issue May 28, 2022 · 10 comments
Closed

Add support for Job Summaries #1187

weineran opened this issue May 28, 2022 · 10 comments
Labels
kind/feature-request New feature or request

Comments

@weineran
Copy link

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!)

@weineran weineran added the kind/feature-request New feature or request label May 28, 2022
@ChristopherHX
Copy link
Contributor

ChristopherHX commented May 29, 2022

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.

@mbaeuerle
Copy link

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.

@weineran
Copy link
Author

weineran commented Jun 8, 2022

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.

@weineran weineran closed this as completed Jun 8, 2022
@eserte
Copy link

eserte commented Jun 22, 2022

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.

@weineran
Copy link
Author

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 weineran reopened this Sep 13, 2022
@mbaeuerle
Copy link

mbaeuerle commented Sep 16, 2022

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!

@tm1000
Copy link

tm1000 commented Sep 22, 2022

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
Copy link
Author

weineran commented Sep 26, 2022

@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.

@jsoref
Copy link
Contributor

jsoref commented Nov 27, 2022

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.

@jsoref
Copy link
Contributor

jsoref commented Apr 4, 2024

$GITHUB_STEP_SUMMARY was added in #1607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants