Search code examples
github-actionscontentful

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?


Solution

  • 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.