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

Add Config Options to Override github Host #830

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GABeech
Copy link

@GABeech GABeech commented Jun 15, 2022

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.

@@ -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:
Copy link

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)
Copy link

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'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is useless

@jk2K
Copy link

jk2K commented Jul 29, 2022

input-helper.ts file should be change

  // 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants