fetchAndRunWpActions = async ({
  helpers,
  pluginOptions,
  since,
  throwFetchErrors = false,
  throwGqlErrors = false,
}) => {
  // check for new, edited, or deleted posts in WP "Action Monitor"
  const wpActions = await getWpActions({
    variables: {
      since,
    },
    helpers,
    throwFetchErrors,
    throwGqlErrors,
  })

  const didUpdate = !!wpActions.length

  if (didUpdate) {
    for (const wpAction of wpActions) {
      // Create, update, and delete nodes
      await handleWpActions({
        helpers,
        pluginOptions,
        wpAction,
      })
    }
  }

  return {
    wpActions,
    didUpdate,
  }
}
fetchAndRunWpActions

fetches a list of latest changes in WordPress
and then acts on those changes