BUGS-NYU / nyu-cs-wiki

The go-to guide for NYU CS students
https://nyucswiki.com
Creative Commons Attribution Share Alike 4.0 International
5 stars 19 forks source link

Add deploy previews for PRs #103

Open calvinatian opened 7 months ago

calvinatian commented 7 months ago

It would be nice if we could deploy PRs to preview what new pages/changes look like online.

There is a beta gh action for this but it does not support previews from forks for security reasons: https://github.com/marketplace/actions/deploy-pr-preview

Someone made another action based on the above for docusaurus but it has been archived: https://github.com/marketplace/actions/build-deploy-to-github-pages-and-deploy-pr-preview

There is also a non-foss service that offers a free tier for oss projects: https://docs.pushpreview.com/installation/docusaurus

rilieo commented 2 months ago

To whoever can work on this:

Because I don't have the right permissions, I can't access the settings page of this repo to add secrets and such. However, I managed to set it up on a repo on my GitHub account here.

I followed this tutorial (also linked in Calvin's comment), but the YAML config file is slightly different.

Something the tutorial also didn't mention was the default for GITHUB_TOKEN in repos is read-only. So, the workflow won't work. You can change to write permissions in Settings > Actions > General. For more granular permissions, you can configure them in the YAML config file, as detailed in GitHub's docs.

Extra security measures should probably be taken because we don't want to get hacked 😶