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

Make LH Scores available as output parameters #41

Open
staabm opened this issue Mar 31, 2020 · 6 comments
Open

Make LH Scores available as output parameters #41

staabm opened this issue Mar 31, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@staabm
Copy link

staabm commented Mar 31, 2020

Would be great to have the main LH Scores available as output parameters in the github action.

That way it would be highly flexible so you could e.g.

  • use the output to post the values in a comment
  • use the values within if-conditions to build additional logic on top of it
  • send the values to a chat-systems webhook
  • etc
@staabm staabm changed the title Make LH Scores available as output Make LH Scores available as output parameters Mar 31, 2020
@alekseykulikov
Copy link
Member

It's a great idea 👍

How do you see a possible output format?
It needs to refer to multiple URLs, and we can set outputs dynamically. My idea:

  perf: ${{ steps.lighthouse.outputs.results-0-performance }}
  bp: ${{ steps.lighthouse.outputs.results-0-best-practices }}

Don't you mind providing a PR for this idea, that we could start exploring the best options?

@alekseykulikov alekseykulikov added the enhancement New feature or request label Apr 1, 2020
@staabm
Copy link
Author

staabm commented Apr 1, 2020

thx for your fast feedback.

your suggestions reads plausible

  perf: ${{ steps.lighthouse.outputs.results-0-performance }}
  bp: ${{ steps.lighthouse.outputs.results-0-best-practices }}

I could also think of something along the lines (not sure this is valid syntax)

   perf: ${{ steps.lighthouse.outputs.results[0].performance }}
   bp: ${{ steps.lighthouse.outputs.results[0].best-practices }}

Don't you mind providing a PR for this idea, that we could start exploring the best options?

sorry, I dont have any experience with github actions

@Berkmann18
Copy link

That would be awesome to have, especially since the artefacts aren't that practical to easily compare the master scores (+ average using, say lh-avg) and the ones from a PR.

@paulirish
Copy link
Contributor

paulirish commented May 2, 2020

@magus also proposed this over here: #2 (comment)
In a subsequent comment he gave an example: https://github.com/magus/lighthouse-ci-output/blob/master/.github/workflows/ci.yml ... and here's the CI logs

I like this since it just allows people to do whatever with the data. I haven't yet seen output be used on other actions I'm consuming but it feels composable and good.


Thinking out loud, the most Lighthouse-y way would be to expose the JSON data that's sitting in the .lighthouseci directory:
image

But that sorta doesn't work, due to how the LHRs are named by timestamp. @patrickhulce what do you think makes sense here?

My first thought is starting with

output: {
  assertionResults,
  lhrs: [...],  // have to iterate and inspect requestedUrl to find your target
  links,
  flags,
}

One downside here is that the "median run" pick isn't part of this data.

@patrickhulce
Copy link

I think what you're looking for here is something similar to the "manifest" output requested in target=filesystem feature.

GoogleChrome/lighthouse-ci#142 (comment)

the output would look something like this then?

output: {
  reports: [
    {
      "url": "http://localhost:8080/path/to/page",
      "representative": true,
      "extension": "html",
      "filePath": "./localhost_8000-path_to_page-2020_01_30_15_12_12.report.html",
      "summary": {"performance": 0.52, "accessibility": 0.79, "seo": 1, "best-practices": 0.23}
    },
  ]
}

@staabm
Copy link
Author

staabm commented May 3, 2020

I like this since it just allows people to do whatever with the data. I haven't yet seen output be used on other actions I'm consuming but it feels composable and good.

Its the native GithubAction way to provide a composable output. Its the way to go.

https://help.github.com/en/actions/building-actions/metadata-syntax-for-github-actions#outputs

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

No branches or pull requests

5 participants