HubSpot form loading, Clearbit, and automated build/linting workflow
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'sonBeforeFormInit
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
andinfo.sourcegraph.com
to recognize users. Our preview environments on Netlifydeploy-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
- Ensure prettier has standardized the proposed changes.
- Ensure HubSpot forms load only once in the production build preview.
- Test
/guides/continuous-developer-onboarding
as an example and submit a test to see if the form submits.