github-repository-provider 7.24.4 → 7.24.5
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
CHANGED
package/src/github-branch.mjs
CHANGED
|
@@ -36,15 +36,10 @@ export class GithubBranch extends Branch {
|
|
|
36
36
|
* @param {string} sha
|
|
37
37
|
*/
|
|
38
38
|
async baseTreeSha(sha) {
|
|
39
|
-
const
|
|
39
|
+
const json = await this.provider.fetchJSON(
|
|
40
40
|
`repos/${this.slug}/git/commits/${sha}`
|
|
41
41
|
);
|
|
42
|
-
|
|
43
|
-
const json = await res.json();
|
|
44
|
-
return json.tree.sha;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
throw new Error(`Unable to decode ${res.url}`);
|
|
42
|
+
return json.tree.sha;
|
|
48
43
|
}
|
|
49
44
|
|
|
50
45
|
/**
|
|
@@ -116,16 +111,11 @@ export class GithubBranch extends Branch {
|
|
|
116
111
|
* @param {string} name
|
|
117
112
|
*/
|
|
118
113
|
async entry(name) {
|
|
119
|
-
const
|
|
114
|
+
const json = await this.provider.fetchJSON(
|
|
120
115
|
`repos/${this.slug}/contents/${name}?ref=${this.ref}`
|
|
121
116
|
);
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
const json = await res.json();
|
|
125
|
-
return new this.entryClass(name, Buffer.from(json.content, "base64"));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
throw new Error(res.status);
|
|
118
|
+
return new this.entryClass(name, Buffer.from(json.content, "base64"));
|
|
129
119
|
}
|
|
130
120
|
|
|
131
121
|
/** @inheritdoc */
|
|
@@ -158,7 +148,7 @@ export class GithubBranch extends Branch {
|
|
|
158
148
|
} catch (e) {
|
|
159
149
|
// errno: 'ERR_STREAM_PREMATURE_CLOSE',
|
|
160
150
|
// code: 'ERR_STREAM_PREMATURE_CLOSE',
|
|
161
|
-
|
|
151
|
+
|
|
162
152
|
this.error(e);
|
|
163
153
|
}
|
|
164
154
|
}
|
|
@@ -214,11 +204,10 @@ class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
|
|
|
214
204
|
}
|
|
215
205
|
|
|
216
206
|
const branch = this.branch;
|
|
217
|
-
const
|
|
207
|
+
const json = await branch.provider.fetchJSON(
|
|
218
208
|
`repos/${branch.slug}/contents/${this.name}?ref=${branch.ref}`
|
|
219
209
|
);
|
|
220
210
|
|
|
221
|
-
const json = await res.json();
|
|
222
211
|
this._buffer = Buffer.from(json.content, "base64");
|
|
223
212
|
return this._buffer;
|
|
224
213
|
}
|
package/src/github-provider.mjs
CHANGED
|
@@ -121,8 +121,7 @@ export class GithubProvider extends MultiGroupProvider {
|
|
|
121
121
|
try {
|
|
122
122
|
const response = await this.fetch(url, options);
|
|
123
123
|
if (!response.ok) {
|
|
124
|
-
|
|
125
|
-
throw new Error(`Unable to fetch ${response.status} ${response.url}`);
|
|
124
|
+
throw new Error(`Unable to fetch ${response.url} (${response.status})`);
|
|
126
125
|
}
|
|
127
126
|
return await response.json();
|
|
128
127
|
} catch (e) {
|
|
@@ -72,7 +72,7 @@ export class GithubPullRequest extends PullRequest {
|
|
|
72
72
|
return p;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const
|
|
75
|
+
const json = await destination.provider.fetchJSON(
|
|
76
76
|
`repos/${destination.repository.slug}/pulls`,
|
|
77
77
|
{
|
|
78
78
|
method: "POST",
|
|
@@ -84,13 +84,7 @@ export class GithubPullRequest extends PullRequest {
|
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (res.ok) {
|
|
90
|
-
return new this(source, destination, json.number, json);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
throw new Error(json.errors.map(e => e.message).join(";"));
|
|
87
|
+
return new this(source, destination, json.number, json);
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
/**
|