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

Github Enterprise Compatibility #579

Open
ghost opened this issue Mar 8, 2021 · 11 comments · Fixed by #580 · May be fixed by #581
Open

Github Enterprise Compatibility #579

ghost opened this issue Mar 8, 2021 · 11 comments · Fixed by #580 · May be fixed by #581
Assignees
Labels
enhancement New feature or request proposal

Comments

@ghost
Copy link

ghost commented Mar 8, 2021

I can not find an option (a clean one) that allows to set the Server URL or Api Url and they seem to be hardcoded to github.com.

Prepare publishing assets
  [INFO] ForceOrphan: false
  /usr/bin/git clone --depth=1 --single-branch --branch gh-pages ***github.com/coresystemsFSM/blog.git /home/runners/actions_github_pages_1615224725805
  Cloning into '/home/runners/actions_github_pages_1615224725805'...
  remote: Invalid username or password.
  fatal: Authentication failed for 'https://github.com/coresystemsFSM/blog.git/'

This fails because our repo is at https://github.tools.sap/coresystemsFSM/blog

As we want to use your action with GitHub Enterprise we would need to be able to customise those.

Link to your contents

I see one entry here but I think its unused during a workflow.

ENV GITHUB_SERVER_URL="https://github.com"

Additional context

I would contribute a PR if you give me 1-2 pointers where I'd need to add things in your structure.

@ghost ghost added the support User support label Mar 8, 2021
@ghost ghost assigned peaceiris Mar 8, 2021
@ghost ghost changed the title sample_title Github Enterprise Compatibility Mar 8, 2021
@peaceiris
Copy link
Owner

Since I have no environment of GitHub Enterprise Server, I was looking forward to this issue, thanks!

export function setGithubToken(

We can modify the function setGithubToken to get a server domain from process.env['GITHUB_SERVER_URL'].

@peaceiris peaceiris added enhancement New feature or request proposal and removed support User support labels Mar 8, 2021
@peaceiris
Copy link
Owner

peaceiris commented Mar 8, 2021

Those are also helpful for us.

export function getServerUrl(): URL {
  // todo: remove GITHUB_URL after support for GHES Alpha is no longer needed
  return new URL(
    process.env['GITHUB_SERVER_URL'] ||
      process.env['GITHUB_URL'] ||
      'https://github.com'
  )
}
const serverUrl = getServerUrl()

return `https://x-access-token:${githubToken}@${serverUrl.hostname}/${publishRepo}.git`;

@mambax
Copy link
Contributor

mambax commented Mar 8, 2021

Should we read the ENV variable or should it be handed into the action by an input?
I can PR both, what is the better design - I am a novice!?

@peaceiris
Copy link
Owner

The former is the best because GITHUB_SERVER_URL can provide a URL of a company's GitHub Enterprise Server.

@mambax
Copy link
Contributor

mambax commented Mar 9, 2021

The former is the best because GITHUB_SERVER_URL can provide a URL of a company's GitHub Enterprise Server.

On it, expect PR 🔄

peaceiris pushed a commit that referenced this issue Mar 9, 2021
@peaceiris peaceiris reopened this Mar 9, 2021
peaceiris pushed a commit that referenced this issue Mar 9, 2021
@peaceiris peaceiris linked a pull request Mar 9, 2021 that will close this issue
@peaceiris
Copy link
Owner

We can test #580 with 3623583

- name: Deploy
  uses: peaceiris/actions-gh-pages@3623583f73a5cfb5ca3632d6234b9564fed73239
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    publish_dir: ./public

@mambax
Copy link
Contributor

mambax commented Mar 10, 2021

I can do that today!

@peaceiris
Copy link
Owner

github_token and personal_token look good to me, it also works well on github.com. I will work on SSH implementation on #581

@mambax
Copy link
Contributor

mambax commented Mar 10, 2021

image
image

I would say: ⭐️⭐️⭐️⭐️⭐️

@peaceiris
Copy link
Owner

peaceiris commented Mar 25, 2021

@dominikmeyersap Could you try v3.8.0?

The release v3.8.0 has capability of deployment with github_token and personal_token, excluding deploy_key. The SSH option for GitHub Enterprise will be implemented in the next release.

@jiminj
Copy link

jiminj commented Dec 14, 2021

I am running this action on a self-hosted runner dedicated to a GHES repository, and seeking a way to publish the pages to an external repository on github.com to deliver documents for our customers. The issue is, the current implementation is not applicable for this kind of usages.

export function getServerUrl(): URL {
  return new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
}

There should be a few ideas to resolve this. One approach I can imagine is introducing an optional parameter such as host (or external_host, whatever) which allows users to designate GitHub host URL. Another idea is to let external_repository env variable accept the repository address with a hostname, such as github.com/peaceiris/actions-gh-pages or github.com:peaceiris/actions-gh-pages. Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request proposal
Projects
None yet
3 participants