I noticed that
onPostBuild
in
gatsby-node
is not called during a preview build. I understand why this would not be called as a means to save time, however I have some post processing that I need to do to make the preview complete. Since the content sync can correlate the content in my CMS with the page to open in preview, I figured it could add that url in the webhook payload, to allow me to process that data separately. For example, it could add something like:
changedUrl: "https://my-site.gtsb.io/blog/post/test/"
Here is an example payload of a webhook as it currently is:
{
body: '# [Gatsby Cloud](https://www.gatsbyjs.com) Build Report\n' +
'**my-site**\n' +
'\n' +
':tada: Your build was successful! [See the Deploy preview here.](https://my-site.gtsb.io)\n' +
'\n' +
'## Build Details\n' +
'\n' +
'[View the build logs here.](https://gatsbyjs.com/...)\n' +
'\n' +
':clock1: Build time: **4m**\n',
buildId: 'abcd',
workspaceName: 'my-site',
siteName: 'my-site',
deployPreviewUrl: 'https://my-site.gtsb.io',
logsUrl: 'https://gatsbyjs.com/dashboard/...',
duration: '215',
resourceId: 'abcd',
resourceType: 'SITE',
event: 'PREVIEW_SUCCEEDED'
}