github-repository-provider 7.24.2 → 7.24.3
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
|
@@ -72,7 +72,7 @@ export class GithubBranch extends Branch {
|
|
|
72
72
|
const shaLatestCommit = await this.refId();
|
|
73
73
|
const shaBaseTree = await this.baseTreeSha(shaLatestCommit);
|
|
74
74
|
|
|
75
|
-
let
|
|
75
|
+
let json = await this.provider.fetchJSON(`repos/${this.slug}/git/trees`, {
|
|
76
76
|
method: "POST",
|
|
77
77
|
body: JSON.stringify({
|
|
78
78
|
base_tree: shaBaseTree,
|
|
@@ -87,11 +87,9 @@ export class GithubBranch extends Branch {
|
|
|
87
87
|
})
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
let json = await result.json();
|
|
91
|
-
|
|
92
90
|
const shaNewTree = json.sha;
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
json = await this.provider.fetchJSON(`repos/${this.slug}/git/commits`, {
|
|
95
93
|
method: "POST",
|
|
96
94
|
body: JSON.stringify({
|
|
97
95
|
message,
|
|
@@ -99,11 +97,10 @@ export class GithubBranch extends Branch {
|
|
|
99
97
|
parents: [shaLatestCommit]
|
|
100
98
|
})
|
|
101
99
|
});
|
|
102
|
-
json = await result.json();
|
|
103
100
|
|
|
104
101
|
const sha = json.sha;
|
|
105
102
|
|
|
106
|
-
|
|
103
|
+
return await this.provider.fetchJSON(
|
|
107
104
|
`repos/${this.slug}/git/refs/heads/${this.name}`,
|
|
108
105
|
{
|
|
109
106
|
method: "PATCH",
|
|
@@ -113,8 +110,6 @@ export class GithubBranch extends Branch {
|
|
|
113
110
|
})
|
|
114
111
|
}
|
|
115
112
|
);
|
|
116
|
-
|
|
117
|
-
return result.json();
|
|
118
113
|
}
|
|
119
114
|
|
|
120
115
|
/**
|
|
@@ -112,13 +112,7 @@ export class GithubRepository extends Repository {
|
|
|
112
112
|
async refId(ref) {
|
|
113
113
|
ref = ref.replace(/^refs\//, "");
|
|
114
114
|
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
if (!res.ok) {
|
|
118
|
-
throw new Error(`Unable to fetch ${res.url}: ${res.code}`);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const json = await res.json();
|
|
115
|
+
const json = await this.provider.fetchJSON(`repos/${this.slug}/git/ref/${ref}`);
|
|
122
116
|
|
|
123
117
|
// TODO why does this happen ?
|
|
124
118
|
if (!json.object.sha) {
|
|
@@ -153,12 +147,11 @@ export class GithubRepository extends Repository {
|
|
|
153
147
|
console.log(res);
|
|
154
148
|
*/
|
|
155
149
|
} else {
|
|
156
|
-
const
|
|
150
|
+
const json = await this.provider.fetchJSON(
|
|
157
151
|
`repos/${this.slug}/git/ref/heads/${
|
|
158
152
|
from === undefined ? this.defaultBranchName : from.name
|
|
159
153
|
}`
|
|
160
154
|
);
|
|
161
|
-
let json = await res.json();
|
|
162
155
|
sha = json.object.sha;
|
|
163
156
|
}
|
|
164
157
|
|