(value: unknown, sourceLabel: string)
| 22 | } |
| 23 | |
| 24 | export function parseInstallSourceConfig(value: unknown, sourceLabel: string): DaemonInstallSource { |
| 25 | if (!value || typeof value !== 'object' || Array.isArray(value)) { |
| 26 | throw new AppError('INVALID_ARGS', `${sourceLabel} installSource must be an object.`); |
| 27 | } |
| 28 | const record = value as Record<string, unknown>; |
| 29 | const type = readRequiredText(record.type, `${sourceLabel} installSource.type`); |
| 30 | if (type !== 'github-actions-artifact') { |
| 31 | throw new AppError( |
| 32 | 'INVALID_ARGS', |
| 33 | `${sourceLabel} installSource.type must be "github-actions-artifact".`, |
| 34 | ); |
| 35 | } |
| 36 | const { owner, repo } = parseRepositorySlug( |
| 37 | readRequiredText(record.repo, `${sourceLabel} installSource.repo`), |
| 38 | `${sourceLabel} installSource.repo`, |
| 39 | ); |
| 40 | return buildGitHubActionsArtifactInstallSource( |
| 41 | owner, |
| 42 | repo, |
| 43 | record.artifact, |
| 44 | `${sourceLabel} installSource.artifact`, |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | function buildGitHubActionsArtifactInstallSource( |
| 49 | owner: string, |
no test coverage detected