Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debounce rebuild triggers (e.g. Contentful and GitHub Actions)

I have a static site (Gatsby) that builts with GitHub Actions and uses data that is organized in Contentful. The content changes frequently in a row (like 10 changes within 10 minutes) and this currently results in the page being recreated multiple times in a row for no reason.

Is there any simple mechanism (in GitHub or Contentful) that can be used handle this issue?

If not, what might be useful approaches to handle this problem?

like image 385
K. D. Avatar asked Oct 25 '25 22:10

K. D.


2 Answers

Contentful DevRel here. 👋

Depending on the needs, I see people implementing static regeneration in different ways.

Rebuild after triggered web hooks

Define and send auto-save or publish webhooks from Contentful to your build server to trigger a regeneration. As you described this can lead to a lot of rebuilds depending on how busy the users in your Contentful space are.

Add a build trigger to the Contentful UI

Contentful's App framework lets you extend the contentful interface with custom UI. For e.g. you could set up this custom webhook app built by the community that allows you to trigger builds on a button click.

For Netlify, there's an integration available. Unfortunately, as of now for other build pipelines (Vercel, Travis, GitHub Action), it would need to be something custom.


For your case, I recommend having a look at a custom build trigger in the UI.

like image 87
stefan judis Avatar answered Oct 29 '25 10:10

stefan judis


This can be addressed on the build pipeline side.

For example, Workflow Run Debounce action for GitHub.

Another approach is to have a middleware like https://hookbox.freighter.studio/ to debounce the webhook requests in between the Headless CMS and the Build Pipeline. Probably there are open-source and self-hosted alternatives.

like image 43
AKd Avatar answered Oct 29 '25 08:10

AKd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!