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

output the raw summary passed to GH Actions Job Summaries #45

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dom-colangelo
Copy link

Add the raw markdown sent to the GitHub Actions Job Summaries page as an output of the action. Allows other steps/jobs to use this raw output without needing to fetch it from the GH API (which currently does not have a working/documented implementation)

@woodruffw
Copy link
Member

Thanks for the PR @dom-colangelo!

Just to make sure I understand: can you say a bit more about your use case here? Is the idea that you want to re-consume/emit the markdown summary elsewhere in your CI?

@dom-colangelo
Copy link
Author

Is the idea that you want to re-consume/emit the markdown summary elsewhere in your CI?

Yup, exactly! I think this adds value to the action as the GH API docs don't seem to indicate any logical way to retrieve the summary value.

Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small nitpicks/comments.

action.yml Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
action.yml Show resolved Hide resolved
@woodruffw
Copy link
Member

Yup, exactly! I think this adds value to the action as the GH API docs don't seem to indicate any logical way to retrieve the summary value.

Makes sense, thank you!

action.yml Outdated Show resolved Hide resolved
@woodruffw
Copy link
Member

LGTM overall (modulo one last nitpick)!

Could you add a short self-test for this as well? I think it'd be sufficient to tack it onto one of the pre-existing tests, and make it as simple as a grep for a string that we know will be in the Markdown summary.

@woodruffw woodruffw added the enhancement New feature or request label Feb 20, 2024
@woodruffw
Copy link
Member

Test failures look like this:

Error: Unable to process file command 'output' successfully.
Error: Invalid format 'Name | Version | ID | Fix Versions | Description'

I think we probably need to base64 encode the job summary before stuffing it into an output variable, similar to how the internal-be-careful-output is encoded.

(Actually, taking a step back: is there a reason you can't use that output? It's marked as internal-only right now, but the only difference between it and this new output is that it's "pure" markdown, whereas the Job Summary output also has a bit of HTML mixed in. If the "pure" output is okay, we can stabilize it instead.)

@dom-colangelo
Copy link
Author

Ahh yeah, your observation & test output pointed me to the fact that multiline env vars in GH Actions are kind of a pain.
I can definitely work with internal-be-careful-output, can't think of a use case where someone would need the extra fluff of the Job Summary.

@woodruffw
Copy link
Member

Sounds good! In that case, if you refactor this PR to make that output public rather than internal only, I'd be happy to merge that.

@dom-colangelo
Copy link
Author

Done! I renamed the output summary-output-base64

@dom-colangelo
Copy link
Author

I believe these self-tests are failing since I'm renaming the var they use for verifying as part of this PR

@woodruffw
Copy link
Member

I believe these self-tests are failing since I'm renaming the var they use for verifying as part of this PR

That might be it. I'll take a closer look tonight 🙂.

(Sorry for the prolonged review here -- I don't have too many cycles for this action at the moment.)

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

Successfully merging this pull request may close these issues.

2 participants