pixelastic / norska

🏔️ Custom SSG using Pug, Webpack, PostCSS and Tailwind.
https://projects.pixelastic.com/norska/
MIT License
8 stars 0 forks source link

Cancel useless deploys on Netlify #51

Closed pixelastic closed 4 years ago

pixelastic commented 4 years ago

Netlify will deploy the website on every commit on master. Many of those commits are made by Renovate, which shouldn't trigger a deploy.

The way it will work is as follow:

The check will involve calling the API to get the SHA, and also calling the API to cancel the build. This will allow all method to be run locally before testing them on Netlify servers, making it easier to test and mock.

Note that Netlify has two built-in ways to cancel a deploy, but I found they were lacking flexibility:

Both method lack context of the current build command being run. In other words, they don't know anything about the norska.config.js file or any commandline arguments passed to norska build, thus can't know which folder to look at. Sure, this could be fixed with extending them with options in case the folder is not the default one, but it would require to change in it two places. I prefer to have it part of the default build:prod method. Added bonus: it will automatically work on every norska website already deployed.

pixelastic commented 4 years ago

I implemented this logic in the last version. It seems to work well for simple websites for now, and for monorepos, one needs to override the list of files to check