Quick Tip #008—Trigger a Netlify Build Every Day with IFTTT
In Quick Tip #007 we talked about migrating away from using a Client-side third-party JavaScript widget to display GitHub stargazer counts and towards a Data fetched at Build time approach.
Updating this data at build time means that the data isn’t necessarily “live” (although the counts are likely cached at by at least one of the upstream dependencies of this widget, with a frequency that is out of your control).
I’m comfortable with these numbers being a little delayed (more than the JS widget method was) and with this new approach I get more control over the frequency of updates BUT I do probably want to run the build at least once a day. To do this, I used an IFTTT applet to trigger my Netlify build to run every morning using Netlify’s Build Hooks.
Heavily inspired by Phil Hawksworth’s work on RSS Jamstack.
Get a Netlify Build Hook Jump to heading
- Go into your Netlify site’s
Build & Deploy
settings - Select
Continuous Deployment
- Add a
Build hook
- Name it
Deploy every day
(or whatever you’d like) - I selected the
master
branch for my site. - Save this and it will provide you with a long URL a la
https://api.netlify.com/build_hooks/SOME_ID_HERE
. This is the URL you want.
Add an IFTTT Applet Jump to heading
- Go to
New Applet
on ifttt.com - Click
+this
- Select the
Date & Time
service - Select the
Every day at
option (or whatever frequency you’d like) - Select the time you’d like the build to run.
- Click
+that
- Select the
Webhooks
service - Select the
Make a web request
option - For the URL field, use the Build Hook URL you’ve already retrieved from Netlify.
- For the Method field, choose
POST
. - For the Content Type field, choose
application/x-www-form-urlencoded
. - For the Body field, type
{}
. - Click the
Create action
button. - Click
Finish
.
All Quick Tips
#001
—Inline Minified CSS#002
—Inline Minified JavaScript#003
—Add Edit on GitHub Links to All Pages#004
—Zero Maintenance Tag Pages for your Blog#005
—Super Simple CSS Concatenation#006
—Adding a 404 Not Found Page to your Static Site#007
—Fetch GitHub Stargazers Count (and More) at Build Time#008
—Trigger a Netlify Build Every Day with IFTTT#009
—Cache Data Requests#010
—Transform Global Data using an `eleventyComputed.js` Global Data File