-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add Config Options to Override github Host #830
base: main
Are you sure you want to change the base?
Conversation
@@ -71,6 +71,13 @@ inputs: | |||
set-safe-directory: | |||
description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>` | |||
default: true | |||
|
|||
setHost: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setHost -> set-host
@@ -52,7 +52,7 @@ class GitAuthHelper { | |||
this.settings = gitSourceSettings || (({} as unknown) as IGitSourceSettings) | |||
|
|||
// Token auth header | |||
const serverUrl = urlHelper.getServerUrl() | |||
const serverUrl = urlHelper.getServerUrl(gitSourceSettings?.setHost) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to
- const serverUrl = urlHelper.getServerUrl()
+ const serverUrl = urlHelper.getServerUrl(this.settings.setHost)
@@ -1,14 +1,15 @@ | |||
import * as assert from 'assert' | |||
import {IGitSourceSettings} from './git-source-settings' | |||
import {URL} from 'url' | |||
import { settings } from 'cluster' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is useless
// Set safe.directory in git global config.
result.setSafeDirectory =
(core.getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE'
+ // set host
+ result.setHost = (core.getInput('set-host') || '')
+ return result |
This is possible solution to #630 it certainly allows you to override between github instances, but would need some investigation to see if putting a non github host in would work properly.
All this does is simply add an optional input called
setHost
that will be returned instead of the github urls if defined.