Skip to content

HubSpot form loading, Clearbit, and automated build/linting workflow

Warren Gifford requested to merge brett/clearbit into main

Created by: bretthayes

This PR ensures HubSpot, jQuery, and Clearbit are loaded sequentially in the proper order, so the necessary integrations work well together. This closes #5396 (closed).

Changelog

  • Changed loadScriptElement to resolve a promise so we can ensure scripts are loaded one by one instead of relying on HubSpot's onBeforeFormInit callback
  • Added a GitHub workflow to ensure our linting and production builds work properly before merging to production
  • Updated our PR template to remove manual testing

Notes

  • jQuery is required for Clearbit
  • Clearbit could be configured to trigger on specific pages but the scripts would still be loaded site-wide. This PR only loads jQuery and Clearbit on pages with HubSpot forms for efficiency and performance gains.
  • Clearbit whitelists about.sourcegraph.com and info.sourcegraph.com to recognize users. Our preview environments on Netlify deploy-preview-{PullRequestNumber}-sourcegraph.netlify.com can't be whitelisted for testing deploy previews since preview URLs are unique per PR. The only visible alternative atm would be to create a temporary Netlify subdomain per branch for whitelisting since I don't think Clearbit offers wildcard referrers (ie: *.sourcegraph.netlify.com)

Test

  1. Ensure prettier has standardized the proposed changes.
  2. Ensure HubSpot forms load only once in the production build preview.
  3. Test /guides/continuous-developer-onboarding as an example and submit a test to see if the form submits.

Merge request reports

Loading