fix: strip optional '.git' suffix from https server remote name. (#1153)
* Strip optional '.git' suffix from https server remote name. * Revert "Strip optional '.git' suffix from https server remote name." This reverts commit c2e9041213985796111bd85229e2375f407c2752. * Strip optional '.git' suffix from https server remote name.
This commit is contained in:
parent
0dfc93c104
commit
15b68d176d
|
@ -50,6 +50,12 @@ describe('utils tests', () => {
|
||||||
)
|
)
|
||||||
expect(remote3.protocol).toEqual('SSH')
|
expect(remote3.protocol).toEqual('SSH')
|
||||||
expect(remote3.repository).toEqual('peter-evans/create-pull-request')
|
expect(remote3.repository).toEqual('peter-evans/create-pull-request')
|
||||||
|
|
||||||
|
const remote4 = utils.getRemoteDetail(
|
||||||
|
'https://github.com/peter-evans/create-pull-request.git'
|
||||||
|
)
|
||||||
|
expect(remote4.protocol).toEqual('HTTPS')
|
||||||
|
expect(remote4.repository).toEqual('peter-evans/create-pull-request')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('getRemoteDetail fails to parse a remote URL', async () => {
|
test('getRemoteDetail fails to parse a remote URL', async () => {
|
||||||
|
|
90
dist/index.js
vendored
90
dist/index.js
vendored
|
@ -8,7 +8,11 @@
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -246,7 +250,11 @@ exports.createOrUpdateBranch = createOrUpdateBranch;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -466,7 +474,11 @@ exports.createPullRequest = createPullRequest;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -599,7 +611,11 @@ exports.GitAuthHelper = GitAuthHelper;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -903,7 +919,11 @@ class GitOutput {
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -1054,7 +1074,11 @@ exports.GitHubHelper = GitHubHelper;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -1156,7 +1180,11 @@ function autoProxyAgent(octokit) {
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -1211,7 +1239,7 @@ function getRemoteDetail(remoteUrl) {
|
||||||
if (!githubServerMatch) {
|
if (!githubServerMatch) {
|
||||||
throw new Error('Could not parse GitHub Server name');
|
throw new Error('Could not parse GitHub Server name');
|
||||||
}
|
}
|
||||||
const httpsUrlPattern = new RegExp('^https?://.*@?' + githubServerMatch[1] + '/(.+/.+)$', 'i');
|
const httpsUrlPattern = new RegExp('^https?://.*@?' + githubServerMatch[1] + '/(.+/.+?)(.git)?$', 'i');
|
||||||
const sshUrlPattern = new RegExp('^git@' + githubServerMatch[1] + ':(.+/.+).git$', 'i');
|
const sshUrlPattern = new RegExp('^git@' + githubServerMatch[1] + ':(.+/.+).git$', 'i');
|
||||||
const httpsMatch = remoteUrl.match(httpsUrlPattern);
|
const httpsMatch = remoteUrl.match(httpsUrlPattern);
|
||||||
if (httpsMatch) {
|
if (httpsMatch) {
|
||||||
|
@ -3839,8 +3867,14 @@ function copyFile(srcFile, destFile, force) {
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
|
||||||
|
const REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
||||||
|
const REGEX_IS_INSTALLATION = /^ghs_/;
|
||||||
|
const REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
||||||
async function auth(token) {
|
async function auth(token) {
|
||||||
const tokenType = token.split(/\./).length === 3 ? "app" : /^v\d+\./.test(token) ? "installation" : "oauth";
|
const isApp = token.split(/\./).length === 3;
|
||||||
|
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
|
||||||
|
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
|
||||||
|
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
|
||||||
return {
|
return {
|
||||||
type: "token",
|
type: "token",
|
||||||
token: token,
|
token: token,
|
||||||
|
@ -3938,7 +3972,7 @@ function _objectWithoutProperties(source, excluded) {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION = "3.5.1";
|
const VERSION = "3.6.0";
|
||||||
|
|
||||||
const _excluded = ["authStrategy"];
|
const _excluded = ["authStrategy"];
|
||||||
class Octokit {
|
class Octokit {
|
||||||
|
@ -4481,18 +4515,22 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
var request = __nccwpck_require__(6234);
|
var request = __nccwpck_require__(6234);
|
||||||
var universalUserAgent = __nccwpck_require__(5030);
|
var universalUserAgent = __nccwpck_require__(5030);
|
||||||
|
|
||||||
const VERSION = "4.6.4";
|
const VERSION = "4.8.0";
|
||||||
|
|
||||||
class GraphqlError extends Error {
|
function _buildMessageForResponseErrors(data) {
|
||||||
constructor(request, response) {
|
return `Request failed due to following response errors:\n` + data.errors.map(e => ` - ${e.message}`).join("\n");
|
||||||
const message = response.data.errors[0].message;
|
}
|
||||||
super(message);
|
|
||||||
Object.assign(this, response.data);
|
class GraphqlResponseError extends Error {
|
||||||
Object.assign(this, {
|
constructor(request, headers, response) {
|
||||||
headers: response.headers
|
super(_buildMessageForResponseErrors(response));
|
||||||
});
|
this.request = request;
|
||||||
this.name = "GraphqlError";
|
this.headers = headers;
|
||||||
this.request = request; // Maintains proper stack trace (only available on V8)
|
this.response = response;
|
||||||
|
this.name = "GraphqlResponseError"; // Expose the errors and response data in their shorthand properties.
|
||||||
|
|
||||||
|
this.errors = response.errors;
|
||||||
|
this.data = response.data; // Maintains proper stack trace (only available on V8)
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
|
|
||||||
|
@ -4550,10 +4588,7 @@ function graphql(request, query, options) {
|
||||||
headers[key] = response.headers[key];
|
headers[key] = response.headers[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new GraphqlError(requestOptions, {
|
throw new GraphqlResponseError(requestOptions, headers, response.data);
|
||||||
headers,
|
|
||||||
data: response.data
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.data.data;
|
return response.data.data;
|
||||||
|
@ -4587,6 +4622,7 @@ function withCustomRequest(customRequest) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.GraphqlResponseError = GraphqlResponseError;
|
||||||
exports.graphql = graphql$1;
|
exports.graphql = graphql$1;
|
||||||
exports.withCustomRequest = withCustomRequest;
|
exports.withCustomRequest = withCustomRequest;
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
|
@ -5950,7 +5986,7 @@ var isPlainObject = __nccwpck_require__(3287);
|
||||||
var nodeFetch = _interopDefault(__nccwpck_require__(467));
|
var nodeFetch = _interopDefault(__nccwpck_require__(467));
|
||||||
var requestError = __nccwpck_require__(537);
|
var requestError = __nccwpck_require__(537);
|
||||||
|
|
||||||
const VERSION = "5.6.0";
|
const VERSION = "5.6.3";
|
||||||
|
|
||||||
function getBufferResponse(response) {
|
function getBufferResponse(response) {
|
||||||
return response.arrayBuffer();
|
return response.arrayBuffer();
|
||||||
|
@ -6991,7 +7027,7 @@ function setup(env) {
|
||||||
namespaces = split[i].replace(/\*/g, '.*?');
|
namespaces = split[i].replace(/\*/g, '.*?');
|
||||||
|
|
||||||
if (namespaces[0] === '-') {
|
if (namespaces[0] === '-') {
|
||||||
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
||||||
} else {
|
} else {
|
||||||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ export function getRemoteDetail(remoteUrl: string): RemoteDetail {
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpsUrlPattern = new RegExp(
|
const httpsUrlPattern = new RegExp(
|
||||||
'^https?://.*@?' + githubServerMatch[1] + '/(.+/.+)$',
|
'^https?://.*@?' + githubServerMatch[1] + '/(.+/.+?)(.git)?$',
|
||||||
'i'
|
'i'
|
||||||
)
|
)
|
||||||
const sshUrlPattern = new RegExp(
|
const sshUrlPattern = new RegExp(
|
||||||
|
|
Loading…
Reference in a new issue