dorny / test-reporter

Displays test results from popular testing frameworks directly in GitHub
MIT License
811 stars 205 forks source link

Add link on badge when using GH Action Summary #492

Open pchalamet opened 3 months ago

pchalamet commented 3 months ago

Problem

As of now, clicking on the badge on GH Action Summary:

image

goes to nowhere interesting (https://camo.githubusercontent.com/xxx).

This PR

This (completely unsolicited) PR introduces a new feature: the badge is now in an anchor, and when clicked, this open the collapsed section and goes to the top of the tests report. At least, I can click roughly on a bigger thing than a small collapsed section 🤷‍♂️

image

Next

Nothing fancy, I just like it this way 🤷‍♂️ Hope you like it too! Thanks for this gh action btw.

jozefizso commented 1 month ago

Hi @pchalamet, thanks for this contribution. I like this change.

How would it work if there are multiple Workflow test summaries in an action?

I think a unique ID should be added to the anchor label.

pchalamet commented 1 month ago

Yes you are right as on my project (link to a GH build - check the first summary output link: https://github.com/MagnusOpera/Terrabuild/actions/runs/10595006592) I add to do this for my own summary output (the first one). As I obviously only use one single test report, it's ok (for me !).

Anyway, probably this would require a more broad fix as link navigation is non-functional in test report summary as of now. It seems to me, that anchors in markdown in summary do not work correctly unless prefix with #user-content. For my own summary output, I mangled all anchor this way: [{node.Label}](#user-content-{uniqueId}). I hope you will understand why I've used #user-content-test-report in this PR as well.

I can of course add a random uuid in this PR, but I would suggest to fix all anchors in another PR. Well, let me know !