Conversation
fc3ed3d to
386ebb6
Compare
386ebb6 to
7a96715
Compare
entrypoint.sh
Outdated
|
|
||
| # Merge custom Lighthouse CI config, if provided | ||
| if [[ -f ".github/lighthouserc-custom.yml" ]]; then | ||
| yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' lighthouserc.yml .github/lighthouserc-custom.yml -i |
There was a problem hiding this comment.
I think I'd just use .lighthouserc.yml as default since that's the default for LHCI. Probably better for us to handle this complexity. Would make our code slightly more complicated, but we're taking that complexity away from the devs.
Maybe something like:
default_config="$(mktemp XXXXX.yml)"
cat <<- EOF > $default_config
...
EOF
if [[ -f ".lighthouserc.yml" ]]; then
yq eval-all '...' $default_config .lighthouserc.yml > .lighthouserc.yml.tmp
mv .lighthouserc.yml.tmp .lighthouserc.yml
else
mv $default_config .lighthouserc.yml
elseThere was a problem hiding this comment.
Much better!
I'd just make sure that it's clearly explained in the README that it doesn't have to be the complete config.
I think that's OK. If you're overwriting them, then it's really on you :P. I think we can fix that with some kind of "Advanced Usage" docs that shows the default configuration and how you can change that. |
The default path to the custom LHCI config is .lighthouserc.yml, but it can be customized. The custom config will be merged with the default one.
7a96715 to
8de9640
Compare
|
@charlespwd I've just pushed an updated version. One thing that I found a bit confusing is the default value for inputs in Anyway, while working on it, I realized that one can overwrite any LHCI configuration setting with environment variables, so it's already possible to modify the default jobs:
lhci:
name: Lighthouse
runs-on: ubuntu-latest
steps:
- name: Lighthouse
...
env:
LHCI_UPLOAD__TARGET: lhci
LHCI_UPLOAD__SERVER_BASE_URL: ...
LHCI_UPLOAD__TOKEN: ...
LHCI_UPLOAD__BASIC_AUTH__USERNAME: ...
LHCI_UPLOAD__BASIC_AUTH__PASSWORD: ...Maybe it's not very convenient, but possible. |
This PR introduces changes that allow one to provide a partial custom LHCI config that gets merged with the default one provided in
entrypoint.shfile and fixes #20.It's a bit of a wip, but I wanted to get some feedback first. Things that are missing:
.lighthouserc.yml)README.mdfileDockerfileto use the updated base image, once it's publishedIt's also possible to overwrite some of the other inputs (e.g. LHCI scores) with this config, which might be a bit confusing.
I tested it with
actand it works. I also pushed the new base Docker image that includesyqtoszimek/lighthouse-ci-action:1.1.0.