You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently added a docs preview to code-server (thank you @BrunoQuaresma ) but now have an issue. If someone forks code-server, submits a PR, the docs preview fails. My hunch says we can't fix this since m is private and there are some tokens/secrets we rely on.
We could have it check if it's a fork and if so, deploy to github pages for that repo if: github.repository == 'cdr/code-server' then run our preview app. if: github.repository != 'cdr/code-server' then run a github pages deploy
While this comment doesn't help code-server repository in isolation, I'd like to throw-in that maybe we should longer-term seek a way to preview docs changes that don't require cloning a monorepo - there's probably a minimal environment we can move to a public repo like cdr/docs-engine or something along those lines
Reacted by Jonathan Yu, Bruno Quaresma and Joe Previte
Yeah, and the other advantage of a public project repo is that we can next export those docs and include them in the product itself, which helps for air-gapped installs
Hmm... I know this is not my place, but can't we get the Vercel app(noticed the Coder site is deployed on Vercel)? I mean, after installing Vercel over here, and enabling that, if anyone makes a PR, even if or if it's not a docs change, it will give a preview, just to be on the safe side. You don't need extra files, all you would need is the Vercel app. Since the repo is directly connected there, it's easier than tokens and workflows, right?
Edit: By "safe side", I meant, no breaking changes on the docs.
I just kinda hit an idea - Netlify. The reason I suggest it is because it has 100 GB of bandwidth, teams, reviewers(website), etc. It has Deploy previews that have a collaboration feature. Although it uses BrowserStack to judge your OS if you review through the previews. The best thing with Netlify is a CMS panel(you'll have to do some coding around to enable it here) so it's easy to edit too. Any ideas?
PS: The reviewers feature is cool but authorized Netlify users only can review - to do that, they'll have to post a comment via the website, it asks the owner of the website to approve the user and if approved, you can log in again and post comments through that. The webpage path, your OS and browser data is also given via BrowserStack(kinda irritating though).
Only problem is that you'll have to tell who posted the comment. It tells that only on the website.
That could work! We use Vercel already though so I don't know if it would be complicated using both Vercel and Netlify. Definitely worth considering though! I'm going to get to this shortly and then I'll share what approach we'll take.
I actually am one of the people who deploy on both CDNs for the same project, and I think it's worth it, since Vercel is one of the best CDNs available and Netlify's Deploy Previews make it easy to review the site, so it's easy to request changes. I think you can make the deploy workflow only ofor theain branch and enable Netlify safely. That might work nicely.
I'd kinda hate to boast, but I am kind of professional in Vercel and Netlify deployments. I think I got an idea. You use Netlify for Deploy previewing, whereas you reprogram the Vercel workflow to deploy only on pushes to the main branch. I think this might solve the problems. Also, don't forget to add a good Netlify config. It's toml, so you will have to click the square brackets key often. Here's how I use it on two of my projects:
Both are from projects I contribute/own, so it's secure! But remember, mine is Docusaurus, based on React.js so you will have to tune the config as needed :)
You use Netlify for Deploy previewing, whereas you reprogram the Vercel workflow to deploy only on pushes to the main branch. I think this might solve the problems.
That might work actually 🤔 I want to at least try getting Vercel deployments to work. If that doesn't work, we could consider this option. Thank you for suggesting!!
Build site with a tool like eleventy: npx @11ty/eleventy --input=docs --output=_site --formats=md --serve --port=3000 and then deploy to GitHub Pages or Netlify. Looks very raw and ugly though.
Guess we'll just have to skip this on forks if not available
Activity
jsjoeio commentedon Aug 24, 2021
@mterhar made a good suggestion
jsjoeio commentedon Aug 24, 2021
@jawnsy said to look here: https://docs.github.com/en/actions/reference/environments
#4020 (comment)
jsjoeio commentedon Sep 13, 2021
Another option would be to skip this workflow if it's from a fork, but then we might not catch bugs 🤔
jsjoeio commentedon Oct 6, 2021
@bpmct found a good solution to this:
greyscaled commentedon Oct 6, 2021
While this comment doesn't help
code-serverrepository in isolation, I'd like to throw-in that maybe we should longer-term seek a way to preview docs changes that don't require cloning a monorepo - there's probably a minimal environment we can move to a public repo likecdr/docs-engineor something along those linesjawnsy commentedon Oct 7, 2021
Yeah, and the other advantage of a public project repo is that we can
next exportthose docs and include them in the product itself, which helps for air-gapped installslg-nineoneninethreenine commentedon Nov 10, 2021
Hmm... I know this is not my place, but can't we get the Vercel app(noticed the Coder site is deployed on Vercel)? I mean, after installing Vercel over here, and enabling that, if anyone makes a PR, even if or if it's not a docs change, it will give a preview, just to be on the safe side. You don't need extra files, all you would need is the Vercel app. Since the repo is directly connected there, it's easier than tokens and workflows, right?
Edit: By "safe side", I meant, no breaking changes on the docs.
11 remaining items
lg-nineoneninethreenine commentedon Jan 29, 2022
I just kinda hit an idea - Netlify. The reason I suggest it is because it has 100 GB of bandwidth, teams, reviewers(website), etc. It has Deploy previews that have a collaboration feature. Although it uses BrowserStack to judge your OS if you review through the previews. The best thing with Netlify is a CMS panel(you'll have to do some coding around to enable it here) so it's easy to edit too. Any ideas?
PS: The reviewers feature is cool but authorized Netlify users only can review - to do that, they'll have to post a comment via the website, it asks the owner of the website to approve the user and if approved, you can log in again and post comments through that. The webpage path, your OS and browser data is also given via BrowserStack(kinda irritating though).
Only problem is that you'll have to tell who posted the comment. It tells that only on the website.
jsjoeio commentedon Jan 31, 2022
That could work! We use Vercel already though so I don't know if it would be complicated using both Vercel and Netlify. Definitely worth considering though! I'm going to get to this shortly and then I'll share what approach we'll take.
lg-nineoneninethreenine commentedon Feb 1, 2022
I actually am one of the people who deploy on both CDNs for the same project, and I think it's worth it, since Vercel is one of the best CDNs available and Netlify's Deploy Previews make it easy to review the site, so it's easy to request changes. I think you can make the deploy workflow only ofor theain branch and enable Netlify safely. That might work nicely.
jsjoeio commentedon Feb 1, 2022
Oh really? I didn't know we had an expert in the house! Okay well I'll keep that in mind and I'll ping you when we work on this.
lg-nineoneninethreenine commentedon Feb 2, 2022
I'd kinda hate to boast, but I am kind of professional in Vercel and Netlify deployments. I think I got an idea. You use Netlify for Deploy previewing, whereas you reprogram the Vercel workflow to deploy only on pushes to the main branch. I think this might solve the problems. Also, don't forget to add a good Netlify config. It's toml, so you will have to click the square brackets key often. Here's how I use it on two of my projects:
Both are from projects I contribute/own, so it's secure! But remember, mine is Docusaurus, based on React.js so you will have to tune the config as needed :)
lg-nineoneninethreenine commentedon Feb 2, 2022
If you need some more help, try contacting me on Slack. I'll respond as soon as I can!
jsjoeio commentedon Feb 2, 2022
That might work actually 🤔 I want to at least try getting Vercel deployments to work. If that doesn't work, we could consider this option. Thank you for suggesting!!
jsjoeio commentedon Feb 15, 2022
I'm going to start working on this right now.
Notes
I'll update this comment with my notes as I go.
Does this problem still exist?
To check, I need to open a PR from a fork.
Root cause
It appears to be a known limitation of GitHub Actions secrets. They can't be made available to forks.
Solutions?
Build site with a tool like
eleventy:npx @11ty/eleventy --input=docs --output=_site --formats=md --serve --port=3000and then deploy to GitHub Pages or Netlify. Looks very raw and ugly though.Guess we'll just have to skip this on forks if not available
jsjoeio commentedon Feb 15, 2022
This might help: https://stackoverflow.com/a/68804665/3015595
jsjoeio commentedon Feb 16, 2022
And this: https://git.xywcc.community/t/how-to-detect-a-pull-request-from-a-fork/18363
lg-nineoneninethreenine commentedon Feb 17, 2022
Seems to me like you are getting an idea on this... Then how would you preview the docs?
jsjoeio commentedon Feb 17, 2022
@im-coder-lg sadly, I don't think you'll be able to :( We'll have to thoroughly check the docs in PRs but we won't have a live preview.