-
Notifications
You must be signed in to change notification settings - Fork 85
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
Netlify integration #30
Conversation
Yay! Ping works |
@exterkamp can I ask you to take a look? 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are cool changes, overall they seem good. I have some questions though.
Can I provide urls that go to a single netlify site, or multiple sites? Can I mix netlify sites and regular sites?
Why do we need a netlifySite
param? Seems like we could look at the domains of the URLs and tell that they need to be adjusted. However, then how do you mix preview-deploy URLs and normal netlify hosted URLs? Is this something we want to support.
I'm also curious if this integrates with the netlify github action? Is there a way to show how you would use both in the recipe?
src/index.js
Outdated
core.startGroup('Action config') | ||
console.log('Input args:', input) | ||
core.endGroup() // Action config | ||
|
||
/*******************************WARMING UP***********************************/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be called "Warming up" or something like "Waiting for preconditions"?
src/index.js
Outdated
core.startGroup('Action config') | ||
console.log('Input args:', input) | ||
core.endGroup() // Action config | ||
|
||
/*******************************WARMING UP***********************************/ | ||
if (input.netlifySite) { | ||
core.startGroup('Warming up') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this would be more descriptive with a group like "Waiting for Netlify site"
src/index.js
Outdated
} | ||
console.log('Waiting for build to be done') | ||
await sleep() | ||
console.log(`Retry ping Netlify`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These retry messages seem excessive, since there will be a "Pinging..." log as soon as the function is called.
src/index.js
Outdated
console.log('Resolve Netlify site error', e) | ||
return Promise.resolve(1) | ||
} | ||
console.log('Waiting for build to be done') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like these waiting msg's could be DRY'd up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated, hope I got your point :)
src/index.js
Outdated
const retryNumber = 5 | ||
let runs = 0 | ||
const sleep = async () => { | ||
return new Promise(r => setTimeout(r, 60000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a good idea to pull out the 60000
ms out so that it can be modified easier/used to dynamically output how long the system is waiting in console logs.
Then maybe modify the logs to say Waiting additional ${seconds} seconds for Netlify build to be done.
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking about it for the next iteration after getting feedback, I didn't wanna overwhelm action settings :)
Co-Authored-By: Shane Exterkamp <[email protected]>
Co-Authored-By: Shane Exterkamp <[email protected]>
Co-Authored-By: Shane Exterkamp <[email protected]>
Co-Authored-By: Shane Exterkamp <[email protected]>
Co-Authored-By: Shane Exterkamp <[email protected]>
What's the use case, using Netlify urls, and some other urls in scope of one repository? My intention was the next, if user has deployed netlify site from github, then in scope this repo he/she can use action for that urls.
Sorry that's my bad, I'll update doc. So, Netlify site can have custom domain, and in this case we can't compose preview url properly. Thank you for bringing it up, It's a really good point because I haven't tested this one yet 👍
I think it's good to have support of real site and preview. Preview is composed based on PR info - lighthouse-ci-action/src/input.js Lines 130 to 136 in 5935285
If it's a master, aka action config for push event, url will be like
Cool, need to play with it. Will get back with info :) |
Co-Authored-By: Shane Exterkamp <[email protected]>
@exterkamp thank you so much for the review and questions 😍 I hope to find time to during the week to add more comments to code and also to clarify all statements related to the confusion between different urls to run. Feel free to ask more :) |
ddc438f
to
5954e70
Compare
@denar90 and I agreed, instead of a custom integration, provide an official Netlify recipe, using one of the community actions: https://github.com/marketplace?type=actions&query=netlify |
Add support for integration with Netlify Preview Site deploy
User changes stuff for the site and creates PR -> Netlify deploy Preview site -> Action do the check against Preview site and show send notification via github/slack
Example I tested stuff
Todo:
P.S. I'll squash commits after final round of feedback :)