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

Preview URL in comment doesn't match Enterprise deployment URL #82

Open
thomas-noimos opened this issue Mar 5, 2024 · 8 comments
Open
Labels
enhancement New feature or request

Comments

@thomas-noimos
Copy link

I'm working on a private repo so I hope you not having access to it won't be an issue, but what I'm facing right now is that the comment gives me the following content:

Deployed preview to https://noimosai.github.io/noimos-ui-kit/pr-preview/pr-18/

However this link doesn't work and gives me a 404. I checked the gh-pages branch and the content is there. Apparently it is a new GitHub thing or I configured something wrong but my actual deployment is another URL:

https://friendly-adventure-lnjz19e.pages.github.io/ and I can access the preview content using the adapted URL https://friendly-adventure-lnjz19e.pages.github.io/pr-preview/pr-18/

Here is my config:
image

Did I configure something wrong ?

@thomas-noimos
Copy link
Author

Sorry I missed the docs where I could configure the custom-url prop, closing this.

@rossjrw
Copy link
Owner

rossjrw commented Mar 6, 2024

Reopening this as a bug just in case. While I've not personally seen a *.pages.github.io before, it looks like that's what URLs for private enterprise repos look like (based on https://docs.github.com/en/enterprise-cloud@latest/pages/getting-started-with-github-pages/changing-the-visibility-of-your-github-pages-site#about-subdomains-for-privately-published-sites).

friendly-adventure-lnjz19e looks randomly-generated - is it permanent? Or does it ever change (over time, with each branch, etc)?

Does custom-url completely resolve the issue?

If all looks good, I'll leave this issue open as a documentation task as it'd be good to mention for enterprise users.

@rossjrw rossjrw reopened this Mar 6, 2024
@rossjrw rossjrw changed the title Preview URL in comment doesn't match the actual deployment URL Preview URL in comment doesn't match Enterprise deployment URL Mar 6, 2024
@rossjrw rossjrw added the bug Something isn't working label Mar 6, 2024
@thomas-noimos
Copy link
Author

@rossjrw yes, using custom-url solved the issue. I completely removed the deployment and disabled GH pages, then enabled again and the randomly generated URL was the same after re-enabling it, so I guess it persists.

@rossjrw rossjrw added documentation Improvements or additions to documentation and removed bug Something isn't working labels Mar 6, 2024
@rossjrw
Copy link
Owner

rossjrw commented Mar 6, 2024

Works for me, thanks for the update!

@CCFenner
Copy link

CCFenner commented Sep 17, 2024

I have issues when using the action on an enterprise instance.

[PR Preview Action](https://<gh-enterprise-host>/rossjrw/pr-preview-action) v1.4.7
:---:
:rocket: Deployed preview to https://<org>.github.io/<repository>/pr-preview/pr-1/
on branch [`gh-pages`](https://<gh-enterprise-host>/<org>/<repository>/tree/gh-pages) at 2024-09-17 07:30 UTC
<!-- Sticky Pull Request Commentpr-preview -->
  1. The link to this repository actually points to the repo on the enterprise instance, which does not exist.
  2. The link to the deployment points to github.io instead of https://pages.<gh-enterprise-host>/<org>/ (I'm using an org site, see types-of-github-pages-sites)

I try to fix 2 with a custom-url for now.

rossjrw added a commit that referenced this issue Sep 17, 2024
Resolves bug on enterprise instances where this action would appear to
originate from the instance (#82)
@rossjrw
Copy link
Owner

rossjrw commented Sep 17, 2024

@CCFenner Thanks for the report!

Issue 1 fixed in v1.4.8 by hardcoding this action's base URL to github.com.

Issue 2 is tougher. I didn't see any documentation indicating that the Pages for an enterprise instance is definitely hosted at a pages subdomain, so I'm assuming that's a custom domain on your instance, in which case the custom-url parameter is the correct solution.

@CCFenner
Copy link

I didn't see any documentation indicating that the Pages for an enterprise instance is definitely hosted at a pages subdomain

It's mentioned here https://docs.github.com/en/[email protected]/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites
Seems to be related to subdomain isolation.

@rossjrw
Copy link
Owner

rossjrw commented Sep 18, 2024

Aha, thank you! Given that starting point it looks like the only reliable way to detect the Pages URL on Enterprise would be via the Octokit API, which does seem feasible. Unfortunately it doesn't look like I'm going to be able to set up automated testing of this action on Enterprise (https://github.com/orgs/community/discussions/47057).

@rossjrw rossjrw added enhancement New feature or request and removed documentation Improvements or additions to documentation labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants