As a little more insight, this scheduled function was part of my FYDLI project which initially used a scheduled function to rebuild the _redirects
file (no longer does though.) To make it easier for others to deploy the project, (and because there was an issue with the NetlifyAPI
from the netlify
package—see here) I opted to use the SITE_ID
environment variable to remove an additional set-up step in creating a build hook (in hindsight, easier to create a build hook and configure a single variable than it is to create an API token and configure two variables.)
So by no means is what I have done the only way. Using a build hook should work just the same with the added benefit as @luke pointed out of not requiring authentication.