mirror of
				https://github.com/actions/checkout.git
				synced 2025-11-04 14:48:39 +08:00 
			
		
		
		
	changes to support ghes alpha release (#199)
This commit is contained in:
		
							parent
							
								
									574281d34c
								
							
						
					
					
						commit
						85b1f35505
					
				
							
								
								
									
										59
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										59
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| 
						 | 
					@ -1266,6 +1266,46 @@ const windowsRelease = release => {
 | 
				
			||||||
module.exports = windowsRelease;
 | 
					module.exports = windowsRelease;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/***/ }),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/***/ 81:
 | 
				
			||||||
 | 
					/***/ (function(__unusedmodule, exports, __webpack_require__) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var __importStar = (this && this.__importStar) || function (mod) {
 | 
				
			||||||
 | 
					    if (mod && mod.__esModule) return mod;
 | 
				
			||||||
 | 
					    var result = {};
 | 
				
			||||||
 | 
					    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
				
			||||||
 | 
					    result["default"] = mod;
 | 
				
			||||||
 | 
					    return result;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					const assert = __importStar(__webpack_require__(357));
 | 
				
			||||||
 | 
					const url_1 = __webpack_require__(835);
 | 
				
			||||||
 | 
					function getApiUrl() {
 | 
				
			||||||
 | 
					    return process.env['GITHUB_API_URL'] || 'https://api.github.com';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.getApiUrl = getApiUrl;
 | 
				
			||||||
 | 
					function getFetchUrl(settings) {
 | 
				
			||||||
 | 
					    assert.ok(settings.repositoryOwner, 'settings.repositoryOwner must be defined');
 | 
				
			||||||
 | 
					    assert.ok(settings.repositoryName, 'settings.repositoryName must be defined');
 | 
				
			||||||
 | 
					    const serviceUrl = getServerUrl();
 | 
				
			||||||
 | 
					    const encodedOwner = encodeURIComponent(settings.repositoryOwner);
 | 
				
			||||||
 | 
					    const encodedName = encodeURIComponent(settings.repositoryName);
 | 
				
			||||||
 | 
					    if (settings.sshKey) {
 | 
				
			||||||
 | 
					        return `git@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    // "origin" is SCHEME://HOSTNAME[:PORT]
 | 
				
			||||||
 | 
					    return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.getFetchUrl = getFetchUrl;
 | 
				
			||||||
 | 
					function getServerUrl() {
 | 
				
			||||||
 | 
					    return new url_1.URL(process.env['GITHUB_URL'] || 'https://github.com');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.getServerUrl = getServerUrl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/***/ }),
 | 
					/***/ }),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/***/ 87:
 | 
					/***/ 87:
 | 
				
			||||||
| 
						 | 
					@ -5109,9 +5149,9 @@ const os = __importStar(__webpack_require__(87));
 | 
				
			||||||
const path = __importStar(__webpack_require__(622));
 | 
					const path = __importStar(__webpack_require__(622));
 | 
				
			||||||
const regexpHelper = __importStar(__webpack_require__(528));
 | 
					const regexpHelper = __importStar(__webpack_require__(528));
 | 
				
			||||||
const stateHelper = __importStar(__webpack_require__(153));
 | 
					const stateHelper = __importStar(__webpack_require__(153));
 | 
				
			||||||
 | 
					const urlHelper = __importStar(__webpack_require__(81));
 | 
				
			||||||
const v4_1 = __importDefault(__webpack_require__(826));
 | 
					const v4_1 = __importDefault(__webpack_require__(826));
 | 
				
			||||||
const IS_WINDOWS = process.platform === 'win32';
 | 
					const IS_WINDOWS = process.platform === 'win32';
 | 
				
			||||||
const HOSTNAME = 'github.com';
 | 
					 | 
				
			||||||
const SSH_COMMAND_KEY = 'core.sshCommand';
 | 
					const SSH_COMMAND_KEY = 'core.sshCommand';
 | 
				
			||||||
function createAuthHelper(git, settings) {
 | 
					function createAuthHelper(git, settings) {
 | 
				
			||||||
    return new GitAuthHelper(git, settings);
 | 
					    return new GitAuthHelper(git, settings);
 | 
				
			||||||
| 
						 | 
					@ -5119,9 +5159,6 @@ function createAuthHelper(git, settings) {
 | 
				
			||||||
exports.createAuthHelper = createAuthHelper;
 | 
					exports.createAuthHelper = createAuthHelper;
 | 
				
			||||||
class GitAuthHelper {
 | 
					class GitAuthHelper {
 | 
				
			||||||
    constructor(gitCommandManager, gitSourceSettings) {
 | 
					    constructor(gitCommandManager, gitSourceSettings) {
 | 
				
			||||||
        this.tokenConfigKey = `http.https://${HOSTNAME}/.extraheader`;
 | 
					 | 
				
			||||||
        this.insteadOfKey = `url.https://${HOSTNAME}/.insteadOf`;
 | 
					 | 
				
			||||||
        this.insteadOfValue = `git@${HOSTNAME}:`;
 | 
					 | 
				
			||||||
        this.sshCommand = '';
 | 
					        this.sshCommand = '';
 | 
				
			||||||
        this.sshKeyPath = '';
 | 
					        this.sshKeyPath = '';
 | 
				
			||||||
        this.sshKnownHostsPath = '';
 | 
					        this.sshKnownHostsPath = '';
 | 
				
			||||||
| 
						 | 
					@ -5129,10 +5166,15 @@ class GitAuthHelper {
 | 
				
			||||||
        this.git = gitCommandManager;
 | 
					        this.git = gitCommandManager;
 | 
				
			||||||
        this.settings = gitSourceSettings || {};
 | 
					        this.settings = gitSourceSettings || {};
 | 
				
			||||||
        // Token auth header
 | 
					        // Token auth header
 | 
				
			||||||
 | 
					        const serverUrl = urlHelper.getServerUrl();
 | 
				
			||||||
 | 
					        this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT]
 | 
				
			||||||
        const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
 | 
					        const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64');
 | 
				
			||||||
        core.setSecret(basicCredential);
 | 
					        core.setSecret(basicCredential);
 | 
				
			||||||
        this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`;
 | 
					        this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`;
 | 
				
			||||||
        this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`;
 | 
					        this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`;
 | 
				
			||||||
 | 
					        // Instead of SSH URL
 | 
				
			||||||
 | 
					        this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT]
 | 
				
			||||||
 | 
					        this.insteadOfValue = `git@${serverUrl.hostname}:`;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    configureAuth() {
 | 
					    configureAuth() {
 | 
				
			||||||
        return __awaiter(this, void 0, void 0, function* () {
 | 
					        return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
| 
						 | 
					@ -5797,14 +5839,12 @@ const io = __importStar(__webpack_require__(1));
 | 
				
			||||||
const path = __importStar(__webpack_require__(622));
 | 
					const path = __importStar(__webpack_require__(622));
 | 
				
			||||||
const refHelper = __importStar(__webpack_require__(227));
 | 
					const refHelper = __importStar(__webpack_require__(227));
 | 
				
			||||||
const stateHelper = __importStar(__webpack_require__(153));
 | 
					const stateHelper = __importStar(__webpack_require__(153));
 | 
				
			||||||
const hostname = 'github.com';
 | 
					const urlHelper = __importStar(__webpack_require__(81));
 | 
				
			||||||
function getSource(settings) {
 | 
					function getSource(settings) {
 | 
				
			||||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
					    return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
        // Repository URL
 | 
					        // Repository URL
 | 
				
			||||||
        core.info(`Syncing repository: ${settings.repositoryOwner}/${settings.repositoryName}`);
 | 
					        core.info(`Syncing repository: ${settings.repositoryOwner}/${settings.repositoryName}`);
 | 
				
			||||||
        const repositoryUrl = settings.sshKey
 | 
					        const repositoryUrl = urlHelper.getFetchUrl(settings);
 | 
				
			||||||
            ? `git@${hostname}:${encodeURIComponent(settings.repositoryOwner)}/${encodeURIComponent(settings.repositoryName)}.git`
 | 
					 | 
				
			||||||
            : `https://${hostname}/${encodeURIComponent(settings.repositoryOwner)}/${encodeURIComponent(settings.repositoryName)}`;
 | 
					 | 
				
			||||||
        // Remove conflicting file path
 | 
					        // Remove conflicting file path
 | 
				
			||||||
        if (fsHelper.fileExistsSync(settings.repositoryPath)) {
 | 
					        if (fsHelper.fileExistsSync(settings.repositoryPath)) {
 | 
				
			||||||
            yield io.rmRF(settings.repositoryPath);
 | 
					            yield io.rmRF(settings.repositoryPath);
 | 
				
			||||||
| 
						 | 
					@ -9159,6 +9199,7 @@ const io = __importStar(__webpack_require__(1));
 | 
				
			||||||
const path = __importStar(__webpack_require__(622));
 | 
					const path = __importStar(__webpack_require__(622));
 | 
				
			||||||
const retryHelper = __importStar(__webpack_require__(587));
 | 
					const retryHelper = __importStar(__webpack_require__(587));
 | 
				
			||||||
const toolCache = __importStar(__webpack_require__(533));
 | 
					const toolCache = __importStar(__webpack_require__(533));
 | 
				
			||||||
 | 
					const urlHelper = __importStar(__webpack_require__(81));
 | 
				
			||||||
const v4_1 = __importDefault(__webpack_require__(826));
 | 
					const v4_1 = __importDefault(__webpack_require__(826));
 | 
				
			||||||
const IS_WINDOWS = process.platform === 'win32';
 | 
					const IS_WINDOWS = process.platform === 'win32';
 | 
				
			||||||
function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath) {
 | 
					function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath) {
 | 
				
			||||||
| 
						 | 
					@ -9209,7 +9250,7 @@ function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath)
 | 
				
			||||||
exports.downloadRepository = downloadRepository;
 | 
					exports.downloadRepository = downloadRepository;
 | 
				
			||||||
function downloadArchive(authToken, owner, repo, ref, commit) {
 | 
					function downloadArchive(authToken, owner, repo, ref, commit) {
 | 
				
			||||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
					    return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
        const octokit = new github.GitHub(authToken);
 | 
					        const octokit = new github.GitHub(authToken, { baseUrl: urlHelper.getApiUrl() });
 | 
				
			||||||
        const params = {
 | 
					        const params = {
 | 
				
			||||||
            owner: owner,
 | 
					            owner: owner,
 | 
				
			||||||
            repo: repo,
 | 
					            repo: repo,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,12 +7,12 @@ import * as os from 'os'
 | 
				
			||||||
import * as path from 'path'
 | 
					import * as path from 'path'
 | 
				
			||||||
import * as regexpHelper from './regexp-helper'
 | 
					import * as regexpHelper from './regexp-helper'
 | 
				
			||||||
import * as stateHelper from './state-helper'
 | 
					import * as stateHelper from './state-helper'
 | 
				
			||||||
 | 
					import * as urlHelper from './url-helper'
 | 
				
			||||||
import {default as uuid} from 'uuid/v4'
 | 
					import {default as uuid} from 'uuid/v4'
 | 
				
			||||||
import {IGitCommandManager} from './git-command-manager'
 | 
					import {IGitCommandManager} from './git-command-manager'
 | 
				
			||||||
import {IGitSourceSettings} from './git-source-settings'
 | 
					import {IGitSourceSettings} from './git-source-settings'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const IS_WINDOWS = process.platform === 'win32'
 | 
					const IS_WINDOWS = process.platform === 'win32'
 | 
				
			||||||
const HOSTNAME = 'github.com'
 | 
					 | 
				
			||||||
const SSH_COMMAND_KEY = 'core.sshCommand'
 | 
					const SSH_COMMAND_KEY = 'core.sshCommand'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IGitAuthHelper {
 | 
					export interface IGitAuthHelper {
 | 
				
			||||||
| 
						 | 
					@ -33,15 +33,15 @@ export function createAuthHelper(
 | 
				
			||||||
class GitAuthHelper {
 | 
					class GitAuthHelper {
 | 
				
			||||||
  private readonly git: IGitCommandManager
 | 
					  private readonly git: IGitCommandManager
 | 
				
			||||||
  private readonly settings: IGitSourceSettings
 | 
					  private readonly settings: IGitSourceSettings
 | 
				
			||||||
  private readonly tokenConfigKey: string = `http.https://${HOSTNAME}/.extraheader`
 | 
					  private readonly tokenConfigKey: string
 | 
				
			||||||
 | 
					  private readonly tokenConfigValue: string
 | 
				
			||||||
  private readonly tokenPlaceholderConfigValue: string
 | 
					  private readonly tokenPlaceholderConfigValue: string
 | 
				
			||||||
  private readonly insteadOfKey: string = `url.https://${HOSTNAME}/.insteadOf`
 | 
					  private readonly insteadOfKey: string
 | 
				
			||||||
  private readonly insteadOfValue: string = `git@${HOSTNAME}:`
 | 
					  private readonly insteadOfValue: string
 | 
				
			||||||
  private sshCommand = ''
 | 
					  private sshCommand = ''
 | 
				
			||||||
  private sshKeyPath = ''
 | 
					  private sshKeyPath = ''
 | 
				
			||||||
  private sshKnownHostsPath = ''
 | 
					  private sshKnownHostsPath = ''
 | 
				
			||||||
  private temporaryHomePath = ''
 | 
					  private temporaryHomePath = ''
 | 
				
			||||||
  private tokenConfigValue: string
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    gitCommandManager: IGitCommandManager,
 | 
					    gitCommandManager: IGitCommandManager,
 | 
				
			||||||
| 
						 | 
					@ -51,6 +51,8 @@ class GitAuthHelper {
 | 
				
			||||||
    this.settings = gitSourceSettings || (({} as unknown) as IGitSourceSettings)
 | 
					    this.settings = gitSourceSettings || (({} as unknown) as IGitSourceSettings)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Token auth header
 | 
					    // Token auth header
 | 
				
			||||||
 | 
					    const serverUrl = urlHelper.getServerUrl()
 | 
				
			||||||
 | 
					    this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader` // "origin" is SCHEME://HOSTNAME[:PORT]
 | 
				
			||||||
    const basicCredential = Buffer.from(
 | 
					    const basicCredential = Buffer.from(
 | 
				
			||||||
      `x-access-token:${this.settings.authToken}`,
 | 
					      `x-access-token:${this.settings.authToken}`,
 | 
				
			||||||
      'utf8'
 | 
					      'utf8'
 | 
				
			||||||
| 
						 | 
					@ -58,6 +60,10 @@ class GitAuthHelper {
 | 
				
			||||||
    core.setSecret(basicCredential)
 | 
					    core.setSecret(basicCredential)
 | 
				
			||||||
    this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`
 | 
					    this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`
 | 
				
			||||||
    this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`
 | 
					    this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Instead of SSH URL
 | 
				
			||||||
 | 
					    this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf` // "origin" is SCHEME://HOSTNAME[:PORT]
 | 
				
			||||||
 | 
					    this.insteadOfValue = `git@${serverUrl.hostname}:`
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async configureAuth(): Promise<void> {
 | 
					  async configureAuth(): Promise<void> {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,23 +8,16 @@ import * as io from '@actions/io'
 | 
				
			||||||
import * as path from 'path'
 | 
					import * as path from 'path'
 | 
				
			||||||
import * as refHelper from './ref-helper'
 | 
					import * as refHelper from './ref-helper'
 | 
				
			||||||
import * as stateHelper from './state-helper'
 | 
					import * as stateHelper from './state-helper'
 | 
				
			||||||
 | 
					import * as urlHelper from './url-helper'
 | 
				
			||||||
import {IGitCommandManager} from './git-command-manager'
 | 
					import {IGitCommandManager} from './git-command-manager'
 | 
				
			||||||
import {IGitSourceSettings} from './git-source-settings'
 | 
					import {IGitSourceSettings} from './git-source-settings'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const hostname = 'github.com'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export async function getSource(settings: IGitSourceSettings): Promise<void> {
 | 
					export async function getSource(settings: IGitSourceSettings): Promise<void> {
 | 
				
			||||||
  // Repository URL
 | 
					  // Repository URL
 | 
				
			||||||
  core.info(
 | 
					  core.info(
 | 
				
			||||||
    `Syncing repository: ${settings.repositoryOwner}/${settings.repositoryName}`
 | 
					    `Syncing repository: ${settings.repositoryOwner}/${settings.repositoryName}`
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
  const repositoryUrl = settings.sshKey
 | 
					  const repositoryUrl = urlHelper.getFetchUrl(settings)
 | 
				
			||||||
    ? `git@${hostname}:${encodeURIComponent(
 | 
					 | 
				
			||||||
        settings.repositoryOwner
 | 
					 | 
				
			||||||
      )}/${encodeURIComponent(settings.repositoryName)}.git`
 | 
					 | 
				
			||||||
    : `https://${hostname}/${encodeURIComponent(
 | 
					 | 
				
			||||||
        settings.repositoryOwner
 | 
					 | 
				
			||||||
      )}/${encodeURIComponent(settings.repositoryName)}`
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Remove conflicting file path
 | 
					  // Remove conflicting file path
 | 
				
			||||||
  if (fsHelper.fileExistsSync(settings.repositoryPath)) {
 | 
					  if (fsHelper.fileExistsSync(settings.repositoryPath)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,7 @@ import * as io from '@actions/io'
 | 
				
			||||||
import * as path from 'path'
 | 
					import * as path from 'path'
 | 
				
			||||||
import * as retryHelper from './retry-helper'
 | 
					import * as retryHelper from './retry-helper'
 | 
				
			||||||
import * as toolCache from '@actions/tool-cache'
 | 
					import * as toolCache from '@actions/tool-cache'
 | 
				
			||||||
 | 
					import * as urlHelper from './url-helper'
 | 
				
			||||||
import {default as uuid} from 'uuid/v4'
 | 
					import {default as uuid} from 'uuid/v4'
 | 
				
			||||||
import {ReposGetArchiveLinkParams} from '@octokit/rest'
 | 
					import {ReposGetArchiveLinkParams} from '@octokit/rest'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +75,7 @@ async function downloadArchive(
 | 
				
			||||||
  ref: string,
 | 
					  ref: string,
 | 
				
			||||||
  commit: string
 | 
					  commit: string
 | 
				
			||||||
): Promise<Buffer> {
 | 
					): Promise<Buffer> {
 | 
				
			||||||
  const octokit = new github.GitHub(authToken)
 | 
					  const octokit = new github.GitHub(authToken, {baseUrl: urlHelper.getApiUrl()})
 | 
				
			||||||
  const params: ReposGetArchiveLinkParams = {
 | 
					  const params: ReposGetArchiveLinkParams = {
 | 
				
			||||||
    owner: owner,
 | 
					    owner: owner,
 | 
				
			||||||
    repo: repo,
 | 
					    repo: repo,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										28
									
								
								src/url-helper.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/url-helper.ts
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,28 @@
 | 
				
			||||||
 | 
					import * as assert from 'assert'
 | 
				
			||||||
 | 
					import {IGitSourceSettings} from './git-source-settings'
 | 
				
			||||||
 | 
					import {URL} from 'url'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function getApiUrl(): string {
 | 
				
			||||||
 | 
					  return process.env['GITHUB_API_URL'] || 'https://api.github.com'
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function getFetchUrl(settings: IGitSourceSettings): string {
 | 
				
			||||||
 | 
					  assert.ok(
 | 
				
			||||||
 | 
					    settings.repositoryOwner,
 | 
				
			||||||
 | 
					    'settings.repositoryOwner must be defined'
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					  assert.ok(settings.repositoryName, 'settings.repositoryName must be defined')
 | 
				
			||||||
 | 
					  const serviceUrl = getServerUrl()
 | 
				
			||||||
 | 
					  const encodedOwner = encodeURIComponent(settings.repositoryOwner)
 | 
				
			||||||
 | 
					  const encodedName = encodeURIComponent(settings.repositoryName)
 | 
				
			||||||
 | 
					  if (settings.sshKey) {
 | 
				
			||||||
 | 
					    return `git@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // "origin" is SCHEME://HOSTNAME[:PORT]
 | 
				
			||||||
 | 
					  return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function getServerUrl(): URL {
 | 
				
			||||||
 | 
					  return new URL(process.env['GITHUB_URL'] || 'https://github.com')
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user