Ensure your site automatically updates in future!

If you are using a static site generator you might want to have some static content that periodically updates, such as a year, let’s see how you can automate it!

George Griffiths
3 min readJan 1, 2022


Every year you probably want to ensure your copyright header on your site(s) is up to date, if you manage lots of sites you will want to automate this!

Out of date copyright header.
Out of date copyright header

To solve this you might want to periodically build your website on Netlify (or similar), the answer isn’t that straight forward and some tools (Github Actions) have gotchas.

Another use case: I recently launched a re-write of my brothers Guitar teaching business website: cgguitar.co.uk, during this rewrite I implemented a feature where I wanted to fetch YouTube playlists at build time.

To achieve my goals, I wanted to scheduled builds of my Netlify website periodically. Netlify doesn’t have this feature built in, however what Netlify does have is a ‘webhook’ which you can call trigger to your build.

In this post I offer two ways to trigger this build, using Github Actions or CircleCI. Using Github Actions can have a significant downside, depending on the use case, continue read to find more about that!

Finding your build hook in Netlify

Login to Netlify and navigate to your site settings and local the “Build & deploy” section, your build hook will be in there.

Netlify build hook

You can test this out by making a curl request in your terminal, you should see it trigger your Netlify website build:

Important: Ensure you keep NETLIFY_BUILD_HOOK_TOKEN secret, otherwise anyone can call your build and potentially cause you to go over your build quota.

Can Github Actions do this?

Github actions let you perform continuous integration in Github, they seem like a perfect fit here…

In your Github repository, in the following folder .github/workflows, you could create:

The above configuration will run every day at around 15:00.

You will want to secure your build_hook token in a secret on Github.

I did this originally and thought job done right? Well, not quite.

Github Actions are disabled on projects after 60 days if there is no activity on the repository, meaning bye bye scheduled builds.

The above limitation might be okay, depending on your use case, but for my case where I wanted to make sure I was fetching the latest videos from a YouTube playlist, this was no good because the website’s code itself may not be updating very often, but there may be new videos added.

Using CircleCI instead

One alternative to Github actions is to use CircleCI to do this instead, it has a generous free tier too so there should be no charge for this.

You can create a configuration like this:

  • Create a folder in your Git repository called .circleci
  • Create a file called config.yml

Populate the config.yml with something like the following (you can use a different image if you wish). This will build every day at 3PM.

Now you can create a project in CircleCI and you should be able to test your build. NETLIFY_BUILD_HOOK_TOKEN will need to be set as an environment variable, in a similar way to Github, in the setting of CircleCI for your project.

CircleCI scheduled build

I posted a full article here about how to pull data from the YouTube API periodically to embed dynamic YouTube playlists without needing to expose your API key to the client: https://griffadev.medium.com/adding-dynamic-content-from-an-api-to-a-static-website-at-build-time-1e086e696442

If you want to read more of my work, please follow me on Twitter @griffadev, or get me a coffee if you feel like it ☕.