github-repository-provider 7.25.53 → 7.25.56
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/README.md +2 -0
- package/package.json +3 -3
- package/src/github-branch.mjs +14 -15
package/README.md
CHANGED
|
@@ -125,6 +125,8 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
125
125
|
|
|
126
126
|
* `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
127
127
|
|
|
128
|
+
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** sha
|
|
129
|
+
|
|
128
130
|
### tree
|
|
129
131
|
|
|
130
132
|
* **See**: <https://developer.github.com/v3/git/trees/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-repository-provider",
|
|
3
|
-
"version": "7.25.
|
|
3
|
+
"version": "7.25.56",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"content-entry": "^4.1.9",
|
|
34
|
-
"fetch-link-util": "^1.0.
|
|
35
|
-
"fetch-rate-limit-util": "^2.4.
|
|
34
|
+
"fetch-link-util": "^1.0.7",
|
|
35
|
+
"fetch-rate-limit-util": "^2.4.11",
|
|
36
36
|
"matching-iterator": "^2.0.3",
|
|
37
37
|
"node-fetch": "^3.2.3",
|
|
38
38
|
"one-time-execution-method": "^2.0.13",
|
package/src/github-branch.mjs
CHANGED
|
@@ -55,14 +55,14 @@ export class GithubBranch extends Branch {
|
|
|
55
55
|
*/
|
|
56
56
|
|
|
57
57
|
const shaLatestCommit = await this.refId();
|
|
58
|
-
const
|
|
58
|
+
const commit = await this.commitForSha(shaLatestCommit);
|
|
59
59
|
|
|
60
60
|
let { json } = await this.provider.fetchJSON(
|
|
61
61
|
`repos/${this.slug}/git/trees`,
|
|
62
62
|
{
|
|
63
63
|
method: "POST",
|
|
64
64
|
body: JSON.stringify({
|
|
65
|
-
base_tree:
|
|
65
|
+
base_tree: commit.tree.sha,
|
|
66
66
|
tree: updates.map(u => {
|
|
67
67
|
return {
|
|
68
68
|
path: u.name,
|
|
@@ -113,26 +113,25 @@ export class GithubBranch extends Branch {
|
|
|
113
113
|
/**
|
|
114
114
|
* {@link https://developer.github.com/v3/git/commits/#get-a-commit}
|
|
115
115
|
* @param {string} sha
|
|
116
|
+
* @return {Object} response
|
|
116
117
|
*/
|
|
117
|
-
async
|
|
118
|
-
if (this.
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
return r;
|
|
118
|
+
async commitForSha(sha) {
|
|
119
|
+
if (this._commitForSha) {
|
|
120
|
+
const json = this._commitForSha.get(sha);
|
|
121
|
+
if (json) {
|
|
122
|
+
return json;
|
|
123
123
|
}
|
|
124
124
|
} else {
|
|
125
|
-
this.
|
|
125
|
+
this._commitForSha = new Map();
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
const { json } = await this.provider.fetchJSON(
|
|
129
129
|
`repos/${this.slug}/git/commits/${sha}`
|
|
130
130
|
);
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return r;
|
|
132
|
+
this._commitForSha.set(sha, json);
|
|
133
|
+
|
|
134
|
+
return json;
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
/**
|
|
@@ -148,9 +147,9 @@ export class GithubBranch extends Branch {
|
|
|
148
147
|
}
|
|
149
148
|
|
|
150
149
|
async *entries(patterns) {
|
|
151
|
-
const
|
|
150
|
+
const commit = await this.commitForSha(await this.refId());
|
|
152
151
|
|
|
153
|
-
for (const entry of matcher(await this.tree(
|
|
152
|
+
for (const entry of matcher(await this.tree(commit.tree.sha), patterns, {
|
|
154
153
|
name: "path"
|
|
155
154
|
})) {
|
|
156
155
|
switch (entry.type) {
|