Hello! I was wondering if it is possible to stop builds on a site when changes are submitted via Netlify CMS? I am scheduling a build with GitHub actions to save build minutes and just wanted to know if i could keep builds on so the build hook still works but not have it run every time a change is published? Thank you in advance
Hey @Munson1970,
You’ll have to make an API call to lock, then unlock, deploys. Here are the calls you need:
- unlock: Netlify API documentation
- lock: Netlify API documentation
Let us know if that works for you!
Just to make sure, this is possible through github actions right? Sorry i am very new at http requests
Oh ok, i actually got it to work but it didnt solve the problem, i want it to actually stop building not just stop deploying when github is activated, is there a way to do that?
Essentially, i never want the site to build except for at 1am every night no matter how many changes are committed to github, we made this site for a client and we are using netlify CMS and each change they make would trigger a build and i just want to prevent that from happening but also leave the builds on so that my github action can still run a build using the build hook
It seems like that may be possible using #5 on this list i found on your guys’ site
Maybe you can try using the ‘ignore build’ feature described here File-based configuration | Netlify Docs. But instead of checking for changed files, you can check the time and return the proper exit code based on that. Would that work for you?
That worked! I was able to check if it was 1AM and cancel the build if it wasn’t. Thank you guys for the help!