Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork repo PRs are not deployed to GitHub Pages #3777

Closed
broccolinisoup opened this issue Sep 28, 2023 · 5 comments
Closed

Fork repo PRs are not deployed to GitHub Pages #3777

broccolinisoup opened this issue Sep 28, 2023 · 5 comments

Comments

@broccolinisoup
Copy link
Member

This issue came up while I was reviewing one of the fork PRs (#3634) that the forks don't get deployed to GitHub Pages.

Although the job runs successfully, it doesn't deploy the commit that comes from the pull request branch, rather it checkouts out main and deploy the last SHA of main. The reason of it does this is because on pull_request_target the ref is the PR base branch and theSHA is the last commit of the PR base branch. (docs reference). Also see this in the fork PR by visiting "Checking out the ref" section under "Checkout default branch" in the built job.

@siddharthkp
Copy link
Member

siddharthkp commented Sep 29, 2023

on pull_request_target the ref is the PR base branch and theSHA is the last commit of the PR base branch.

Woooow, that means it hasn't worked since we moved from vercel to github pages?! 😱

Turns out I added pull_request_target 😅 in #2207 (Aug 2, 2022),

Right now, forks don't get deployment previews because secrets/tokens can not be shared with forks safely.
However, there's an event called pull_request_target, which runs github actions on the target repo (primer/react) but runs the code from the source repo (example: user/primer-react-fork), this is the perfect solution for 99% of contributions (1% is when you are making changes to github actions workflows)

I'm not sure what the fix for this would be 😓

@lesliecdubs
Copy link
Member

Suggestion from PRC planning: sounds like a fix could be similar to how we have our VRT flow set up, cc @joshblack.

@joshblack
Copy link
Member

From an implementation perspective, I think this could follow a similar flow to VRT where we basically build up things like storybook and the docs and pass those along to a separate workflow that runs on workflow_run. A rough sketch of this could be:

  • Add a job to CI, or a separate workflow, that uploads a github-pages artifact with upload-artifact
    • Here is a similar step in vrt
  • Add a github-pages workflow that runs on workflow_run after the CI workflow (or whatever the name is of the one created in step 1)

@joshblack joshblack removed their assignment Oct 2, 2023
Copy link
Contributor

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.

@github-actions github-actions bot added the Stale label Mar 30, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2024
@broccolinisoup broccolinisoup reopened this Apr 8, 2024
@github-actions github-actions bot removed the Stale label Apr 8, 2024
Copy link
Contributor

github-actions bot commented Oct 5, 2024

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 5, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants