@bakers-build/addon-forge-github 0.19.1-next.3 → 0.19.1-next.4

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 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 fromEnv = typeof s.private_key_env === 'string'
28
- ? process.env[s.private_key_env]
29
- : undefined;
30
- const privateKey = typeof s.private_key === 'string' ? s.private_key : fromEnv;
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}`;
@@ -34,7 +34,7 @@
34
34
  "private_key_env": {
35
35
  "type": "string",
36
36
  "minLength": 1,
37
- "description": "Names the conductor environment variable that holds the credential."
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",
3
+ "version": "0.19.1-next.4",
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",
@@ -21,11 +21,11 @@
21
21
  "directory": "bakers-cli/addons/forge-github"
22
22
  },
23
23
  "peerDependencies": {
24
- "@bakers-build/addon-forge": "^0.19.1-next.3",
25
- "@bakers-build/core": "^0.19.1-next.3"
24
+ "@bakers-build/addon-forge": "^0.19.1-next.4",
25
+ "@bakers-build/core": "^0.19.1-next.4"
26
26
  },
27
27
  "bakersBuild": {
28
- "commit": "81f2970d26d8cf6b4367eb513b68032c8aabe616",
28
+ "commit": "682730a11f21199f6bccc581bce98fead5655458",
29
29
  "channel": "next"
30
30
  }
31
31
  }