Skip to content

Investigate changing docs preview workflow  #4027

Description

@jsjoeio

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.

https://github.com/cdr/code-server/blob/main/.github/workflows/docs-preview.yaml
https://github.com/cdr/code-server/pull/4020/checks?check_run_id=3413784650

We should investigate fixing this.

Activity

  1. added this to the Backlog milestone on Aug 24, 2021
  2. jsjoeio commented on Aug 24, 2021

    @jsjoeio
    ContributorAuthor

    @mterhar made a good suggestion

    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

  3. jsjoeio commented on Aug 24, 2021

    @jsjoeio
    ContributorAuthor
  4. modified the milestones: Backlog, 3.12.1 on Sep 13, 2021
  5. jsjoeio commented on Sep 13, 2021

    @jsjoeio
    ContributorAuthor

    Another option would be to skip this workflow if it's from a fork, but then we might not catch bugs 🤔

  6. jsjoeio commented on Oct 6, 2021

    @jsjoeio
    ContributorAuthor

    @bpmct found a good solution to this:

    However, it looks like we can allow forks to use the secrets from the upstream repo and even add approvals. https://dev.to/petrsvihlik/using-environment-protection-rules-to-secure-secrets-when-building-external-forks-with-pullrequesttarget-hci

  7. greyscaled commented on Oct 6, 2021

    @greyscaled
    Contributor

    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

  8. jawnsy commented on Oct 7, 2021

    @jawnsy

    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

  9. lg-nineoneninethreenine commented on Nov 10, 2021

    @lg-nineoneninethreenine
    Contributor

    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.

  10. 11 remaining items

  11. added this to the 4.0.3 milestone on Jan 27, 2022
  12. lg-nineoneninethreenine commented on Jan 29, 2022

    @lg-nineoneninethreenine
    Contributor

    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.

  13. jsjoeio commented on Jan 31, 2022

    @jsjoeio
    ContributorAuthor

    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.

  14. lg-nineoneninethreenine commented on Feb 1, 2022

    @lg-nineoneninethreenine
    Contributor

    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.

  15. jsjoeio commented on Feb 1, 2022

    @jsjoeio
    ContributorAuthor

    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.

  16. lg-nineoneninethreenine commented on Feb 2, 2022

    @lg-nineoneninethreenine
    Contributor

    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 :)

  17. lg-nineoneninethreenine commented on Feb 2, 2022

    @lg-nineoneninethreenine
    Contributor

    If you need some more help, try contacting me on Slack. I'll respond as soon as I can!

  18. jsjoeio commented on Feb 2, 2022

    @jsjoeio
    ContributorAuthor

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

  19. jsjoeio commented on Feb 15, 2022

    @jsjoeio
    ContributorAuthor

    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.

    image

    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=3000 and then deploy to GitHub Pages or Netlify. Looks very raw and ugly though.

    image

    Guess we'll just have to skip this on forks if not available

  20. jsjoeio commented on Feb 15, 2022

    @jsjoeio
    ContributorAuthor
  21. jsjoeio commented on Feb 16, 2022

    @jsjoeio
    ContributorAuthor
  22. lg-nineoneninethreenine commented on Feb 17, 2022

    @lg-nineoneninethreenine
    Contributor

    Seems to me like you are getting an idea on this... Then how would you preview the docs?

  23. jsjoeio commented on Feb 17, 2022

    @jsjoeio
    ContributorAuthor

    @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.

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

Metadata

Metadata

Assignees

Labels

ciIssues related to cidocsDocumentation relatedhigh-priorityThis issue needs to be resolved ASAP

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions