@bakers-build/addon-forge-github 0.19.1-next.3 → 0.19.1-next.5
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/dist/src/index.js +8 -7
- package/options.schema.json +1 -1
- package/package.json +5 -4
package/dist/src/index.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
// shortly before it expires; or, with `auth: 'gh'`, the conductor's own `gh`
|
|
4
4
|
// login. The repository comes from config, never from a clone's `origin`.
|
|
5
5
|
import { createSign } from 'node:crypto';
|
|
6
|
-
import { cliToken, requestJson, requestText, tail, } from '@bakers-build/addon-forge/backend';
|
|
6
|
+
import { cliToken, envCredential, requestJson, requestText, tail, } from '@bakers-build/addon-forge/backend';
|
|
7
7
|
const API = 'https://api.github.com';
|
|
8
8
|
const REFRESH_MS = 60_000;
|
|
9
|
-
function settingsOf(raw) {
|
|
9
|
+
function settingsOf(raw, context) {
|
|
10
10
|
const s = (raw ?? {});
|
|
11
11
|
if (typeof s.repository !== 'string' ||
|
|
12
12
|
!/^[\w.-]+\/[\w.-]+$/.test(s.repository))
|
|
@@ -24,10 +24,11 @@ function settingsOf(raw) {
|
|
|
24
24
|
for (const k of ['app_id', 'installation_id'])
|
|
25
25
|
if (typeof s[k] !== 'number' && (typeof s[k] !== 'string' || s[k] === ''))
|
|
26
26
|
throw new Error(`${k} must be the App's numeric ${k.replace('_', ' ')}`);
|
|
27
|
-
const
|
|
28
|
-
?
|
|
29
|
-
:
|
|
30
|
-
|
|
27
|
+
const privateKey = typeof s.private_key === 'string'
|
|
28
|
+
? s.private_key
|
|
29
|
+
: typeof s.private_key_env === 'string' && s.private_key_env
|
|
30
|
+
? envCredential(context, 'private_key_env', s.private_key_env)
|
|
31
|
+
: undefined;
|
|
31
32
|
if (!privateKey)
|
|
32
33
|
throw new Error('private_key or private_key_env (naming a set environment variable) must give the App private key');
|
|
33
34
|
return {
|
|
@@ -70,7 +71,7 @@ const unsupported = async () => {
|
|
|
70
71
|
throw new Error('origin issues are unsupported on GitHub; record the step in Manual review');
|
|
71
72
|
};
|
|
72
73
|
const factory = async (raw, context) => {
|
|
73
|
-
const s = settingsOf(raw);
|
|
74
|
+
const s = settingsOf(raw, context);
|
|
74
75
|
const doFetch = context.fetch ?? fetch;
|
|
75
76
|
const [owner] = s.repository.split('/');
|
|
76
77
|
const repo = `${API}/repos/${s.repository}`;
|
package/options.schema.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"private_key_env": {
|
|
35
35
|
"type": "string",
|
|
36
36
|
"minLength": 1,
|
|
37
|
-
"description": "Names the
|
|
37
|
+
"description": "Names the variable that holds the credential: the conductor's shell, then the project env file, then ~/.bakers/.bakers.env."
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"if": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-forge-github",
|
|
3
|
-
"version": "0.19.1-next.
|
|
3
|
+
"version": "0.19.1-next.5",
|
|
4
4
|
"description": "bakers.build forge backend for GitHub: a GitHub App installation token scoped to one repository. Implements @bakers-build/addon-forge's ForgeBackend contract.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,17 +15,18 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
+
"homepage": "https://bakers.build",
|
|
18
19
|
"repository": {
|
|
19
20
|
"type": "git",
|
|
20
21
|
"url": "git+https://github.com/bakers-build/bakers-build.git",
|
|
21
22
|
"directory": "bakers-cli/addons/forge-github"
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
24
|
-
"@bakers-build/addon-forge": "^0.19.1-next.
|
|
25
|
-
"@bakers-build/core": "^0.19.1-next.
|
|
25
|
+
"@bakers-build/addon-forge": "^0.19.1-next.5",
|
|
26
|
+
"@bakers-build/core": "^0.19.1-next.5"
|
|
26
27
|
},
|
|
27
28
|
"bakersBuild": {
|
|
28
|
-
"commit": "
|
|
29
|
+
"commit": "56715034b78f52be0c88ef037b9dc099572bbd06",
|
|
29
30
|
"channel": "next"
|
|
30
31
|
}
|
|
31
32
|
}
|