Skip to content

Prevent GitHub Pages deployment on forks#176

Open
oasis-parzival wants to merge 1 commit intogbdev:masterfrom
oasis-parzival:jarvis-fix-1775325395
Open

Prevent GitHub Pages deployment on forks#176
oasis-parzival wants to merge 1 commit intogbdev:masterfrom
oasis-parzival:jarvis-fix-1775325395

Conversation

@oasis-parzival
Copy link
Copy Markdown

Closes #167

This PR adds a conditional check to the build_and_deploy.yaml workflow 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 the github.event_name and github.repository context variables to determine if the workflow is running on a fork.

Copy link
Copy Markdown
Member

@avivace avivace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@Les-Wet
Copy link
Copy Markdown
Contributor

Les-Wet commented Apr 4, 2026

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.

Copy link
Copy Markdown
Member

@avivace avivace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub Pages Deployment Error on Forks

3 participants