-
Notifications
You must be signed in to change notification settings - Fork 46
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
Use links of the deploy preview, not actual deployment #14
Comments
I see that your site is built using Docusaurus. To reflect the changed base URL in your build, you should use the You may wish to determine this value programmatically in your config.js file. Your preview workflow might for example set an environment variable containing the path of the preview deployment, which you could then pick up in your config, e.g.: # .github/workflows/test-deploy.yml
...
jobs:
test-deploy:
...
steps:
...
- run: echo "PREVIEW_PATH=pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV"
- name: Build website
run: yarn build
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./docs/website/build/ // docs/website/docusaurus.config.js
let baseUrl = "/odo-gh-actions/"
if (process.env.PREVIEW_PATH) baseUrl += process.env.PREVIEW_PATH
module.exports = {
...
baseUrl: baseUrl,
...
} I'm going to record this as a documentation task, because while I feel that it's beyond the scope of the action to do this automatically, it should at least be mentioned in the documentation along with a pointer on how to get started setting it up. |
james-s-w-clark/docusaurus-pr-preview-gh#3 Here's an example of this working in a public repo. The above suggestion works great. |
Very helpful example. Perhaps this can be promoted somewhere in the docs? |
I'm running into an issue where clicking on any link on the landing page on deploy preview take me to the page on actual deployment being served from the root of
gh-pages
branch instead of the deploy preview generated using pr-review-action.For example, my index page has a link to "Introduction" which takes me to
<user>.github.io/<repo>/docs/introduction
. For a deploy preview built using pr-review-action, I expect it to take me to<user>.github.io/<repo>/pr-review/pr-<pr-number>/docs/introduction
.For reference, you can take a look at https://github.com/dharmit/odo-gh-actions/pull/6. The deploy preview is available at https://dharmit.github.io/odo-gh-actions/pr-preview/pr-6/. But when I click on "Read the docs" button, it takes me to https://dharmit.github.io/odo-gh-actions/docs/introduction while I expect it to take me to https://dharmit.github.io/odo-gh-actions/pr-preview/pr-6//docs/introduction.
The text was updated successfully, but these errors were encountered: