github-repository-provider 7.25.52 → 7.25.55
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 +5 -5
- package/src/github-branch.mjs +20 -7
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.55",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"lint:docs": "documentation lint ./src/**/*.mjs"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"content-entry": "^4.1.
|
|
34
|
-
"fetch-link-util": "^1.0.
|
|
33
|
+
"content-entry": "^4.1.9",
|
|
34
|
+
"fetch-link-util": "^1.0.7",
|
|
35
35
|
"fetch-rate-limit-util": "^2.4.10",
|
|
36
36
|
"matching-iterator": "^2.0.3",
|
|
37
37
|
"node-fetch": "^3.2.3",
|
|
38
38
|
"one-time-execution-method": "^2.0.13",
|
|
39
|
-
"repository-provider": "^27.0.
|
|
39
|
+
"repository-provider": "^27.0.4"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"ava": "^4.1.0",
|
|
43
43
|
"c8": "^7.11.0",
|
|
44
44
|
"documentation": "^13.2.5",
|
|
45
|
-
"repository-provider-test-support": "^1.12.
|
|
45
|
+
"repository-provider-test-support": "^1.12.11",
|
|
46
46
|
"semantic-release": "^19.0.2"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
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,
|
|
@@ -85,7 +85,7 @@ export class GithubBranch extends Branch {
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
r = await this.provider.fetchJSON(
|
|
88
|
-
`repos/${this.slug}/git
|
|
88
|
+
`repos/${this.slug}/git/${this.ref}`,
|
|
89
89
|
{
|
|
90
90
|
method: "PATCH",
|
|
91
91
|
body: JSON.stringify({
|
|
@@ -113,12 +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
|
+
async commitForSha(sha) {
|
|
119
|
+
if (this._commitForSha) {
|
|
120
|
+
const json = this._commitForSha.get(sha);
|
|
121
|
+
if (json) {
|
|
122
|
+
return json;
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
this._commitForSha = new Map();
|
|
126
|
+
}
|
|
127
|
+
|
|
118
128
|
const { json } = await this.provider.fetchJSON(
|
|
119
129
|
`repos/${this.slug}/git/commits/${sha}`
|
|
120
130
|
);
|
|
121
|
-
|
|
131
|
+
|
|
132
|
+
this._commitForSha.set(sha, json);
|
|
133
|
+
|
|
134
|
+
return json;
|
|
122
135
|
}
|
|
123
136
|
|
|
124
137
|
/**
|
|
@@ -134,9 +147,9 @@ export class GithubBranch extends Branch {
|
|
|
134
147
|
}
|
|
135
148
|
|
|
136
149
|
async *entries(patterns) {
|
|
137
|
-
const
|
|
150
|
+
const commit = await this.commitForSha(await this.refId());
|
|
138
151
|
|
|
139
|
-
for (const entry of matcher(await this.tree(
|
|
152
|
+
for (const entry of matcher(await this.tree(commit.tree.sha), patterns, {
|
|
140
153
|
name: "path"
|
|
141
154
|
})) {
|
|
142
155
|
switch (entry.type) {
|