benbalter / jekyll-remote-theme

Jekyll plugin for building Jekyll sites with any GitHub-hosted theme
MIT License
291 stars 78 forks source link

Add ability to use themes hosted on enterprise GitHub instances. #53

Closed jallenwork closed 5 years ago

jallenwork commented 5 years ago

I'd like to use this for repos hosted in our enterprise instance at work (as would several of my coworkers) so I thought I would throw this against the wall and see if it stuck. I'm not a ruby programmer, so any stylistic feedback is welcome. Fixes #43


View rendered README.md

welcome[bot] commented 5 years ago

Welcome! Congrats on your first pull request to Jekyll Remote Theme. If you haven't already, please be sure to check out the contributing guidelines.

benbalter commented 5 years ago

Thanks for this @jallenwork. Curious, do you need to be able to pull from multiple enterprise instances, or could the host be set in the config file as an override?

jallenwork commented 5 years ago

I personally don't have any need to use multiple enterprise instances, so for my use case a config file override would work fine. Would you prefer that the host get it's own entry in _config.yml?
Something like:
remote_theme_host: github.<enterprise>.com

benbalter commented 5 years ago

@jallenwork really appreciate the PR. Based on your work, I pushed up a minor refactor that I think makes things a bit more readable and user friendly.

Now, themes can be in the form of owner/repo or http://example.com/owner/repo.

If no host is supplied, github.com is assumed.

If a host is supplied, it must be the GitHub Enterprise instance which the site is being built on (to prevent builds on GitHub.com being sent to a malicious server).

We always download from codeload.THEME_HOST.

Does that make sense / meet your needs?

jallenwork commented 5 years ago

@benbalter This looks great, thanks for putting in the extra effort on this, I really appreciate it. This should work famously for myself and others running GH Enterprise instances.

welcome[bot] commented 5 years ago

Congrats on getting your first pull request to Jekyll Remote Theme merged! Without amazing humans like you submitting pull requests, we couldn’t run this project. You rock! :tada:

If you're interested in tackling another bug or feature, take a look at the open issues, especially those labeled help wanted.

dmittman commented 2 years ago

From reading through the comments and by administering a GitHub Enterprise Server for a number of years, I think I have an understanding of the requirements for hosting remote themes on GHES, but I thought I'd double-check my understanding.

The comments mention codeload, which suggests that your GHES is required to have subdomain isolation enabled for this approach to work.

Also, the code, I think, mentions that the repo hosting the remote must be "public." The term public can mean a few things, depending on how your GHES is configured, but I'm assuming that it means that the repo hosting the remote theme must not require authentication of any kind.

GHES's that either don't have subdomain isolation enabled or are using private mode can't use this approach.