Prevent GitHub Pages deployment on forks#176
Prevent GitHub Pages deployment on forks#176oasis-parzival wants to merge 1 commit intogbdev:masterfrom
Conversation
avivace
left a comment
There was a problem hiding this comment.
I guess this is ok, but doesn't let the deployment on forks at all anymore, no?
Shouldn't we try to deploy on the pages of the fork?
I think no deployment on the fork is the desired behavior. At least from my point of view, there’s no point in deploying a website when forking just for a PR. Unless we want to allow checking the website after deployment to see how it looks but you can always just run it locally to make sure it’s all good. |
avivace
left a comment
There was a problem hiding this comment.
Yeah I would actually go back on this.
I wouldn’t disable deployments for forks.
They’re useful for contributors who don’t want to set up the full toolchain locally, especially for non-trivial changes (everything that cannot simply previewed as markdown). A Pages preview is often the easiest way to validate output, doesn't even require cloning locally..
Instead, we could keep deployments but make them conditional, only run if GitHub Pages is enabled on the fork, otherwise skip without failing. This should also play well with url: ${{ steps.deployment.outputs.page_url }}
Closes #167
This PR adds a conditional check to the
build_and_deploy.yamlworkflow file to skip the deployment step when the workflow is triggered on a fork. This resolves the 404 errors seen on forked repositories by preventing the action from attempting to deploy to a non-existent GitHub Pages source. The check utilizes thegithub.event_nameandgithub.repositorycontext variables to determine if the workflow is running on a fork.