github-repository-provider 7.24.10 → 7.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/github-provider.mjs +21 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-repository-provider",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.25.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"content-entry": "^3.0.2",
|
|
34
34
|
"fetch-link-util": "^1.0.4",
|
|
35
|
-
"fetch-rate-limit-util": "^
|
|
35
|
+
"fetch-rate-limit-util": "^2.0.2",
|
|
36
36
|
"matching-iterator": "^2.0.0",
|
|
37
37
|
"node-fetch": "3.1.0",
|
|
38
38
|
"one-time-execution-method": "^2.0.9",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"ava": "^3.15.0",
|
|
43
43
|
"c8": "^7.11.0",
|
|
44
44
|
"documentation": "^13.2.5",
|
|
45
|
-
"repository-provider-test-support": "^1.9.
|
|
45
|
+
"repository-provider-test-support": "^1.9.1",
|
|
46
46
|
"semantic-release": "^18.0.1"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
package/src/github-provider.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { GithubOwner } from "./github-owner.mjs";
|
|
|
9
9
|
import { GithubPullRequest } from "./github-pull-request.mjs";
|
|
10
10
|
export { GithubRepository, GithubBranch, GithubOwner, GithubPullRequest };
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const host = "github.com";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* <!-- skip-example -->
|
|
@@ -48,29 +48,27 @@ export class GithubProvider extends MultiGroupProvider {
|
|
|
48
48
|
static get attributes() {
|
|
49
49
|
return {
|
|
50
50
|
...super.attributes,
|
|
51
|
+
host: {
|
|
52
|
+
type: "string",
|
|
53
|
+
env: ["{{instanceIdentifier}}HOST", "GH_HOST"],
|
|
54
|
+
default: "github.com"
|
|
55
|
+
},
|
|
51
56
|
ssh: {
|
|
52
57
|
type: "url",
|
|
53
|
-
default: `git@${
|
|
58
|
+
default: `git@${host}:`
|
|
54
59
|
},
|
|
55
60
|
url: {
|
|
56
61
|
type: "url",
|
|
57
62
|
env: ["{{instanceIdentifier}}SERVER_URL"],
|
|
58
63
|
set: value => (value.endsWith("/") ? value : value + "/"),
|
|
59
|
-
default: `https://${
|
|
64
|
+
default: `https://${host}/`
|
|
60
65
|
},
|
|
61
66
|
api: {
|
|
62
67
|
type: "url",
|
|
63
68
|
env: ["{{instanceIdentifier}}API_URL"],
|
|
64
69
|
set: value => value.replace(/\/$/, ""),
|
|
65
|
-
default: `https://api.${
|
|
66
|
-
},
|
|
67
|
-
/*
|
|
68
|
-
domain : {
|
|
69
|
-
type: "string",
|
|
70
|
-
env: ["GH_HOST"],
|
|
71
|
-
default: "github.com"
|
|
70
|
+
default: `https://api.${host}`
|
|
72
71
|
},
|
|
73
|
-
*/
|
|
74
72
|
"authentication.token": {
|
|
75
73
|
type: "string",
|
|
76
74
|
// @see https://cli.github.com/manual/gh_help_environment
|
|
@@ -103,14 +101,15 @@ export class GithubProvider extends MultiGroupProvider {
|
|
|
103
101
|
|
|
104
102
|
fetch(url, options = {}) {
|
|
105
103
|
return rateLimitHandler(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
104
|
+
fetch,
|
|
105
|
+
new URL(url, this.api),
|
|
106
|
+
{
|
|
107
|
+
...options,
|
|
108
|
+
headers: {
|
|
109
|
+
authorization: `token ${this.authentication.token}`,
|
|
110
|
+
...options.headers
|
|
111
|
+
}
|
|
112
|
+
},
|
|
114
113
|
(millisecondsToWait, rateLimitRemaining, nthTry, response) => {
|
|
115
114
|
this.rateLimitRemaining = rateLimitRemaining;
|
|
116
115
|
|
|
@@ -199,9 +198,9 @@ export class GithubProvider extends MultiGroupProvider {
|
|
|
199
198
|
return super.repositoryBases.concat([
|
|
200
199
|
this.url,
|
|
201
200
|
"git+" + this.url,
|
|
202
|
-
`git+ssh://${
|
|
203
|
-
`git://${
|
|
204
|
-
`git@${
|
|
201
|
+
`git+ssh://${host}`,
|
|
202
|
+
`git://${host}/`,
|
|
203
|
+
`git@${host}:`
|
|
205
204
|
]);
|
|
206
205
|
}
|
|
207
206
|
|
|
@@ -224,11 +223,3 @@ replaceWithOneTimeExecutionMethod(
|
|
|
224
223
|
);
|
|
225
224
|
|
|
226
225
|
export default GithubProvider;
|
|
227
|
-
|
|
228
|
-
/*
|
|
229
|
-
{
|
|
230
|
-
"400" : { repeat: 3, timeout: 100 }
|
|
231
|
-
"401" : { repeat: 0 }
|
|
232
|
-
"500" : { repeat: 3, timeout: 100 }
|
|
233
|
-
}
|
|
234
|
-
*/
|