MCPcopy Create free account
hub / github.com/lightdash/lightdash / stepVerifyToken

Function stepVerifyToken

scripts/dev-github-reconcile.cjs:261–271  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

259}
260
261async function stepVerifyToken(client) {
262 const secret = need('RUNNING_SECRET');
263 const org = await orgUuid(client);
264 const row = await client.query(
265 "SELECT encode(encrypted_installation_id,'hex') AS hex FROM github_app_installations WHERE organization_uuid=$1", [org]);
266 if (!row.rows.length) throw new Error('no installation row');
267 const id = decrypt(Buffer.from(row.rows[0].hex, 'hex'), secret);
268 const res = await gh(`/app/installations/${id}/access_tokens`, { method: 'POST' });
269 if (res.status === 201) console.log(`OK: installation token mints (id=${id}, HTTP 201)`);
270 else { console.error(`FAIL: verify-token -- POST access_tokens for id=${id} -> ${res.status}`); process.exit(1); }
271}
272
273// A shared base snapshot bakes in the *creating* instance's warehouse host/port, so a
274// bootstrapped instance points its local-postgres warehouse at a dead port and every

Callers 1

Calls 7

needFunction · 0.85
orgUuidFunction · 0.85
ghFunction · 0.85
fromMethod · 0.80
errorMethod · 0.80
decryptFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected