readthedocs / actions

GitHub Actions for Read the Docs
MIT License
33 stars 10 forks source link

preview generates incorrect link #31

Closed edublancas closed 1 year ago

edublancas commented 1 year ago

Hi,

I have a private project that uses readthedocs.com for building docs. I enabled previews by adding the following:

name: Read the Docs Pull Request Preview
on:
  pull_request_target:
    types:
      - opened

permissions:
  pull-requests: write

jobs:
  documentation-links:
    runs-on: ubuntu-latest
    steps:
      - uses: readthedocs/actions/preview@v1
        with:
          platform: business # I thought this would fix it but it didn't
          project-slug: slug

PRs are correctly triggering documentation preview but the generated link added in the top comment looks like this:

📚 Documentation preview 📚: https://slug--number.org.readthedocs.build/en/68/

I noticed that manually changing the .org -> .com fixes the issue:

📚 Documentation preview 📚: https://slug--number.com.readthedocs.build/en/68/

Am I doing something wrong or is this a bug?

edublancas commented 1 year ago

Update: platform: business does fix the problem. It didn't work the first time because I tested it on a PR. Then I realized this is a pull_request_target, which uses the workflow definition in the main branch. Editing the workflow in main and then opening a PR fixed the problem.

humitos commented 1 year ago

Excellent! I'm happy that you figured it out and it's working for you now. Thanks for explaining what was your solution also 👍