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

Get previews for PRs from forks #330

Open
gregsdennis opened this issue Feb 22, 2024 · 19 comments
Open

Get previews for PRs from forks #330

gregsdennis opened this issue Feb 22, 2024 · 19 comments
Assignees
Labels
🐛 Bug Indicates that the issue is a bug or defect. Status: In Progress This issue is being worked on, and has someone assigned.

Comments

@gregsdennis
Copy link
Member

Describe the bug

Currently, it seems that preview sites are not generated for PRs from forks. This is annoying.

How to Reproduce

Example: #314

Expected behavior

It should generate a preview site, like this.

@benjagm
Copy link
Collaborator

benjagm commented Feb 23, 2024

This is how Cloudflare CI Pages works. Preview only works with deployments from branchs:

https://developers.cloudflare.com/pages/configuration/preview-deployments/

@benjagm
Copy link
Collaborator

benjagm commented Feb 23, 2024

Maybe you we can add a note in the CONTRIBUTING.md file?

@benjagm benjagm added 🐛 Bug Indicates that the issue is a bug or defect. Status: Triage This is the initial status for an issue that requires triage. labels Feb 23, 2024
@Gmin2
Copy link
Contributor

Gmin2 commented Feb 23, 2024

Hey @benjagm working on it

@benjagm
Copy link
Collaborator

benjagm commented Feb 23, 2024

Hey @benjagm working on it

Thanks for your interest and proactivity. Please wait until @gregsdennis have time to reply and share more thoughts and we put the issue in status available.

@Relequestual
Copy link
Member

It is possible but requires additional setup.
We would have to create a new CloudFlare Pages project, and use the API to make the deployments.

We would need to make a CI script which would...

  • Run the build locally.
  • Direct upload using the Wrangler API tool making sure to specify it's a preview.

There's a guide here: https://developers.cloudflare.com/pages/how-to/use-direct-upload-with-continuous-integration/

If we agree it's worth doing, I'm happy to at least start off that work.

@Relequestual Relequestual added the agenda To be added to the next Community Meeting label Feb 23, 2024
@Gmin2
Copy link
Contributor

Gmin2 commented Feb 23, 2024

Please have a look at #297

cc @Relequestual @gregsdennis

@benjagm
Copy link
Collaborator

benjagm commented Feb 23, 2024

Please have a look at #297

What is the relationship of that issue with this one @Min2who ?

@benjagm
Copy link
Collaborator

benjagm commented Feb 23, 2024

If we agree it's worth doing

I think having the previews for PRs from forks will be great.

@Gmin2
Copy link
Contributor

Gmin2 commented Feb 23, 2024

If we agree it's worth doing

I think having the previews for PRs from forks will be great.

@benjagm please look at the discussion here

@gregsdennis
Copy link
Member Author

@Min2who I think that's only tangentially related. This issue is for having the CI generate preview sites for PRs from forks like it does for PRs from this repo.

While that PR would benefit from resolving this issue, I don't think it addresses this issue at all.

@ashu8912
Copy link

ashu8912 commented Mar 2, 2024

Hii Folks I was looking at https://github.com/json-schema-org/website/tree/main/.github/workflows but I don't see the workflow for creating previews for PRs when they are created through a branch, how do we achieve that??

@benjagm benjagm removed the agenda To be added to the next Community Meeting label Mar 3, 2024
@benjagm
Copy link
Collaborator

benjagm commented Mar 4, 2024

Hi everyone! Cloudflare does not provide preview for PRs opened from forks, only from branches of the same org so we'll need to do some work in cloudflare for this. @Relequestual and I are working on this.

@Gmin2
Copy link
Contributor

Gmin2 commented Mar 4, 2024

Hi everyone! Cloudflare does not provide preview for PRs opened from forks, only from branches of the same org so we'll need to do some work in cloudflare for this. @Relequestual and I are working on this.

Hey @benjagm have you and @Relequestual have given thought of deploying it to vercel as vercel does give a previews of PR

@benjagm
Copy link
Collaborator

benjagm commented Mar 4, 2024

have given thought of deploying it to vercel as vercel does give a previews of PR

I think it is ok what we have now. We just need some time to do this setup in cloudflare.

@benjagm benjagm added Status: In Progress This issue is being worked on, and has someone assigned. and removed Status: Triage This is the initial status for an issue that requires triage. labels Mar 13, 2024
@aialok
Copy link
Collaborator

aialok commented May 14, 2024

Please assign this issue to me as I am currently working on it.
Thank you!

@benjagm
Copy link
Collaborator

benjagm commented May 14, 2024

Thanks Alok! All yours.

@gregsdennis
Copy link
Member Author

Please be aware that this will likely require tasks in Cloudflare, which will require someone with access.

@aialok
Copy link
Collaborator

aialok commented May 16, 2024

Hey !!
I've spent the past few days trying to figure out how to get previews for PRs from the fork repository. Unfortunately, none of the configurations I tried seemed to work.
However, I finally found a solution in the GitHub Marketplace.
Refined Cloudflare Pages Action is being used by several well-known open-source projects, some with over 3k stars:

I reached out to the maintainer of this GitHub action about security concerns, and he confirmed that it's safe to use.

image

While testing this in my organization's dummy repository, I encountered a major bug. I notified the maintainer through Discord, and he have fixed this now.
However, there is one downside of this as we have to remove native cloudflare github-apps support from this and we need to write our own workflow for productions and preview.

Here's a preview of my PR:

PR URL: AuroraBenzyl/Testing-Cloudflare-Pages#22

Preview URL: https://761499e4.testing-cloudflare-pages-7wt.pages.dev/

Production URL: https://testing-cloudflare-pages-7wt.pages.dev/

Workflow : https://github.com/AuroraBenzyl/Testing-Cloudflare-Pages/blob/master/.github/workflows/preview.yaml

Screenshot from 2024-05-16 21-34-11

Also, this is a known issue to Cloudflare they might fix this in future:
https://developers.cloudflare.com/pages/platform/known-issues/#builds-and-deployment

Looking for your thought on this!!!

Thank you : )

@benjagm
Copy link
Collaborator

benjagm commented May 20, 2024

What do you think @Relequestual ? This ok for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Indicates that the issue is a bug or defect. Status: In Progress This issue is being worked on, and has someone assigned.
Projects
Status: In Progress
Development

No branches or pull requests

6 participants