w3c / wcag

Web Content Accessibility Guidelines
https://w3c.github.io/wcag/guidelines/22/
Other
1.14k stars 256 forks source link

Add workflow for Netlify PR deploys for custom PR comment #3990

Closed kfranqueiro closed 4 months ago

kfranqueiro commented 4 months ago

This PR adds a github workflow as an alternative to Netlify's automatic PR deploys.

Note: Turn off Deploy Previews in Netlify site configuration > build & deploy before merging, to avoid duplicate builds/comments.

Motivation

Using a GitHub action allows us to customize the comment that appears in the PR, e.g. to specify more useful preview links. Unfortunately this sort of customization doesn't seem to be possible through Netlify's own PR deploy preview feature.

Example custom PR comment using this branch (note, this intentionally shows a failed check, as explained under Behavior)

Contrast with Netlify's comment format, which will appear below this post.

Behavior

GitHub Secrets

This requires 2 github secrets which I've set up:

netlify[bot] commented 4 months ago

Deploy Preview for wcag2 ready!

Name Link
Latest commit e28b79a3d889e5de953a00e16c11656c9994d432
Latest deploy log https://app.netlify.com/sites/wcag2/deploys/66a284e0d7140e0008c3741e
Deploy Preview https://deploy-preview-3990--wcag2.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

kfranqueiro commented 4 months ago

Didn't anticipate the action attempting to run from the PR itself, which raises the significant issue that this approach will not work on PRs from forks. I'm inclined to think this might make it not worthwhile for this particular repo - all we'd be getting out of it is linking to .../techniques and .../understanding rather than the top-level link supplied by Netlify's default PR comment, and I'm not sure that's worth the cost of not getting deploy previews from forks. Will discuss.