mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
25 lines
637 B
TypeScript
25 lines
637 B
TypeScript
import readline from 'node:readline';
|
|
import type { AllConfig } from '../../../../config/types';
|
|
|
|
// istanbul ignore next
|
|
export async function setConfig(config: AllConfig): Promise<AllConfig> {
|
|
if (process.env.CODESPACES !== 'true') {
|
|
return config;
|
|
}
|
|
|
|
if (!config.token && process.env.GITHUB_TOKEN) {
|
|
config.token = process.env.GITHUB_TOKEN;
|
|
}
|
|
|
|
if (!config.repositories?.length) {
|
|
const rl = readline.promises.createInterface({
|
|
input: process.stdin,
|
|
output: process.stdout,
|
|
});
|
|
const repo = await rl.question('\n\nRepository name: ');
|
|
config.repositories = [repo];
|
|
}
|
|
|
|
return config;
|
|
}
|