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

docs: make GitHub actions explanation aligned with the code #6776

Merged
merged 2 commits into from
Feb 27, 2022
Merged

docs: make GitHub actions explanation aligned with the code #6776

merged 2 commits into from
Feb 27, 2022

Conversation

arifszn
Copy link
Contributor

@arifszn arifszn commented Feb 27, 2022

Motivation

This PR solves the issue #6775.

@facebook-github-bot
Copy link
Contributor

Hi @arifszn!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

Most Docusaurus repos do not have a website/ folder, and have the docusaurus.config.js at the root. Please do not change the actions file—#6591 is made on purpose. Please only make the text aligned with the code.

@netlify
Copy link

netlify bot commented Feb 27, 2022

✔️ [V2]
Built without sensitive environment variables

🔨 Explore the source changes: ea5179a

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/621b32573270f900084ed029

😎 Browse the preview: https://deploy-preview-6776--docusaurus-2.netlify.app

@arifszn
Copy link
Contributor Author

arifszn commented Feb 27, 2022

This PR also solves the issue, Error: Dependencies lock file is not found in /home/runner/work/docusaurus/docusaurus. Supported file patterns: yarn.lock which is mentioned here. Can I change the action files to solve this?

@github-actions
Copy link

github-actions bot commented Feb 27, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 50
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-6776--docusaurus-2.netlify.app/

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Feb 27, 2022

Error: Dependencies lock file is not found in /home/runner/work/docusaurus/docusaurus. Supported file patterns: yarn.lock

Did you commit your lock file? Also, if you are using NPM, you need to use cache: npm

@arifszn
Copy link
Contributor Author

arifszn commented Feb 27, 2022

Error: Dependencies lock file is not found in /home/runner/work/docusaurus/docusaurus. Supported file patterns: yarn.lock

Did you commit your lock file? Also, if you are using NPM, you need to use cache: npm

Yes, I did. This is the example repo. I am guessing, due to subfolder. However, caching with actions/cache@v2 works like a charm.

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Feb 27, 2022

The actions file works for me without any modification: https://github.com/jc-verse/docusaurus-template/blob/master/.github/workflows/deploy.yml

It doesn't work for you, because your yarn.lock is not at the root of the repo, which is a bad pattern. If it doesn't break here, it will break further down the chain. You need to run setup-node in the website folder instead.

@arifszn
Copy link
Contributor Author

arifszn commented Feb 27, 2022

The actions file works for me without any modification: https://github.com/jc-verse/docusaurus-template/blob/master/.github/workflows/deploy.yml

It doesn't work for you, because your yarn.lock is not at the root of the repo, which is a bad pattern. If it doesn't break here, it will break further down the chain. You need to run setup-node in the website folder instead.

Can you please give an example? I have set it up as follows. So shouldn't setup-node run in the website directory too like other commands? Example: Install dependencies is running under website directory automatically as I have set it as default.

defaults:
  run:
    working-directory: ./website

Also, I feel like, many users won't have a separate repo for documentation and will keep the documentation source in website/ following docusaurus's itself. Many popular libraries follow this structure too. So it's fair to have an instruction for subdirectory if anyone chooses to.

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 27, 2022
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Feb 27, 2022

The configuration should be trivial—even if we have another file about configuration for websites not at the root, it would only be adding a bunch of working-directory: ./website.

No matter where your documentation is placed, you should be able to run yarn install at the root. Not having the lock file at the root of your repo is a clear anti-pattern.

Also, I think the portion of users that have a monorepo but don't know how to set up CI is far less than those that just want a working website and use a standalone repo for their website (e.g. for personal/organization use).

@Josh-Cena Josh-Cena added the pr: documentation This PR works on the website or other text documents in the repo. label Feb 27, 2022
@Josh-Cena
Copy link
Collaborator

@arifszn The actions files are working for most repos. Even if it doesn't work out-of-the-box for all, modification is trivial. For example, here's a working example for a website in the website/ folder: https://github.com/yanivam/react-svg-worldmap/blob/main/.github/workflows/deploy.yml

The yarn build executes build in all workspaces: https://github.com/yanivam/react-svg-worldmap/blob/main/package.json#L10

If you have a repo with multiple projects and multiple package.jsons, you'd better use a workspace management tool like Nx or Yarn, but for any tool, you would end up with yarn.lock at the root of the repo.

@Josh-Cena Josh-Cena changed the title fix(website): update github actions files docs: make GitHub actions explanation aligned with the code Feb 27, 2022
@Josh-Cena Josh-Cena merged commit 95ab082 into facebook:main Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: documentation This PR works on the website or other text documents in the repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants