github-repository-provider 7.23.21 → 7.23.25
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 +2 -2
- package/src/github-branch.mjs +18 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-repository-provider",
|
|
3
|
-
"version": "7.23.
|
|
3
|
+
"version": "7.23.25",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"lint:docs": "documentation lint ./src/**/*.mjs"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"content-entry": "^2.7.
|
|
33
|
+
"content-entry": "^2.7.1",
|
|
34
34
|
"fetch-link-util": "^1.0.4",
|
|
35
35
|
"fetch-rate-limit-util": "^1.1.6",
|
|
36
36
|
"matching-iterator": "^2.0.0",
|
package/src/github-branch.mjs
CHANGED
|
@@ -127,12 +127,12 @@ export class GithubBranch extends Branch {
|
|
|
127
127
|
`repos/${this.slug}/contents/${name}?ref=${this.ref}`
|
|
128
128
|
);
|
|
129
129
|
|
|
130
|
-
if (res.
|
|
131
|
-
|
|
130
|
+
if (res.ok) {
|
|
131
|
+
const json = await res.json();
|
|
132
|
+
return new this.entryClass(name, Buffer.from(json.content, "base64"));
|
|
132
133
|
}
|
|
133
|
-
const json = await res.json();
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
throw new Error(res.status);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/** @inheritdoc */
|
|
@@ -140,12 +140,10 @@ export class GithubBranch extends Branch {
|
|
|
140
140
|
const res = await this.provider.fetch(
|
|
141
141
|
`repos/${this.slug}/contents/${name}?ref=${this.ref}`
|
|
142
142
|
);
|
|
143
|
-
if
|
|
144
|
-
|
|
143
|
+
if(res.ok) {
|
|
144
|
+
const json = await res.json();
|
|
145
|
+
return new this.entryClass(name, Buffer.from(json.content, "base64"));
|
|
145
146
|
}
|
|
146
|
-
|
|
147
|
-
const json = await res.json();
|
|
148
|
-
return new this.entryClass(name, Buffer.from(json.content, "base64"));
|
|
149
147
|
}
|
|
150
148
|
|
|
151
149
|
/**
|
|
@@ -153,11 +151,18 @@ export class GithubBranch extends Branch {
|
|
|
153
151
|
* @param tree_sha
|
|
154
152
|
*/
|
|
155
153
|
async tree(tree_sha) {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
const url = `repos/${this.slug}/git/trees/${tree_sha}?recursive=1`;
|
|
155
|
+
let res;
|
|
156
|
+
|
|
157
|
+
for(const i = 0; i < 2; i++) {
|
|
158
|
+
res = await this.provider.fetch(url);
|
|
159
|
+
if(res.ok) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
159
164
|
const json = await res.json();
|
|
160
|
-
return json.tree;
|
|
165
|
+
return json.tree;
|
|
161
166
|
}
|
|
162
167
|
|
|
163
168
|
async *entries(patterns) {
|