github-repository-provider 7.25.32 → 7.25.36

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-repository-provider",
3
- "version": "7.25.32",
3
+ "version": "7.25.36",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,13 +36,13 @@
36
36
  "matching-iterator": "^2.0.2",
37
37
  "node-fetch": "3.2.0",
38
38
  "one-time-execution-method": "^2.0.10",
39
- "repository-provider": "^26.7.0"
39
+ "repository-provider": "^26.7.5"
40
40
  },
41
41
  "devDependencies": {
42
42
  "ava": "^4.0.1",
43
43
  "c8": "^7.11.0",
44
44
  "documentation": "^13.2.5",
45
- "repository-provider-test-support": "^1.12.2",
45
+ "repository-provider-test-support": "^1.12.6",
46
46
  "semantic-release": "^19.0.2"
47
47
  },
48
48
  "engines": {
@@ -75,7 +75,7 @@ export class GithubBranch extends Branch {
75
75
  }
76
76
  );
77
77
 
78
- const r = await this.provider.fetchJSON(`repos/${this.slug}/git/commits`, {
78
+ let r = await this.provider.fetchJSON(`repos/${this.slug}/git/commits`, {
79
79
  method: "POST",
80
80
  body: JSON.stringify({
81
81
  message,
@@ -84,16 +84,18 @@ export class GithubBranch extends Branch {
84
84
  })
85
85
  });
86
86
 
87
- return await this.provider.fetchJSON(
87
+ r = await this.provider.fetchJSON(
88
88
  `repos/${this.slug}/git/refs/heads/${this.name}`,
89
89
  {
90
90
  method: "PATCH",
91
91
  body: JSON.stringify({
92
92
  ...options,
93
- sha : r.json.sha
93
+ sha: r.json.sha
94
94
  })
95
95
  }
96
96
  );
97
+
98
+ return r.json;
97
99
  }
98
100
 
99
101
  /**
@@ -166,7 +168,6 @@ export class GithubBranch extends Branch {
166
168
  });
167
169
  }
168
170
  }
169
-
170
171
  }
171
172
 
172
173
  class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
@@ -1,9 +1,7 @@
1
1
  import fetch from "node-fetch";
2
2
  import { replaceWithOneTimeExecutionMethod } from "one-time-execution-method";
3
3
  import { stateActionHandler } from "fetch-rate-limit-util";
4
- import {
5
- BufferContentEntry,
6
- } from "content-entry";
4
+ import { BufferContentEntry } from "content-entry";
7
5
 
8
6
  import { MultiGroupProvider } from "repository-provider";
9
7
  import { GithubRepository } from "./github-repository.mjs";
@@ -64,13 +62,17 @@ export class GithubProvider extends MultiGroupProvider {
64
62
  type: "url",
65
63
  env: ["{{instanceIdentifier}}SERVER_URL"],
66
64
  set: value => (value.endsWith("/") ? value : value + "/"),
67
- default: `https://${host}/`
65
+ default: `https://${host}/`,
66
+ /*getDefault: (attribute, object, properties) =>
67
+ `https://${object.host || properties.host && properties.host.value}`*/
68
68
  },
69
69
  api: {
70
70
  type: "url",
71
71
  env: ["{{instanceIdentifier}}API_URL"],
72
72
  set: value => value.replace(/\/$/, ""),
73
- default: `https://api.${host}`
73
+ default: `https://api.${host}`,
74
+ /* getDefault: (attribute, object, properties) =>
75
+ `https://api.${object.host || properties.host.value}`*/
74
76
  },
75
77
  "authentication.token": {
76
78
  type: "string",
@@ -153,9 +155,9 @@ export class GithubProvider extends MultiGroupProvider {
153
155
  return super.repositoryBases.concat([
154
156
  this.url,
155
157
  "git+" + this.url,
156
- `git+ssh://${host}`,
157
- `git://${host}/`,
158
- `git@${host}:`
158
+ `git+ssh://${this.host}`,
159
+ `git://${this.host}/`,
160
+ `git@${this.host}:`
159
161
  ]);
160
162
  }
161
163
 
@@ -107,12 +107,12 @@ export class GithubRepository extends Repository {
107
107
  async refId(ref) {
108
108
  ref = ref.replace(/^refs\//, "");
109
109
 
110
- const { json } = await this.provider.fetchJSON(
110
+ const { response, json } = await this.provider.fetchJSON(
111
111
  `repos/${this.slug}/git/ref/${ref}`
112
112
  );
113
113
 
114
114
  // TODO why does this happen ?
115
- if (!json.object.sha) {
115
+ if (!response.ok || !json.object.sha) {
116
116
  throw new Error(`No refId for '${this.name}' '${ref}'`);
117
117
  }
118
118