Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 5x 5x 5x 2x 2x 2x 5x 5x 5x 5x 3x 2x 5x 5x 5x 2x 3x 3x 3x 1x 1x 1x | import 'reflect-metadata';
import type { Container } from 'inversify';
import { DispatchActionCommand } from '../../envilder/application/dispatch/DispatchActionCommand.js';
import type { DispatchActionCommandHandler } from '../../envilder/application/dispatch/DispatchActionCommandHandler.js';
import type { CliOptions } from '../../envilder/domain/CliOptions.js';
import type { ILogger } from '../../envilder/domain/ports/ILogger.js';
import { TYPES } from '../../envilder/types.js';
import { Startup } from './Startup.js';
let serviceProvider: Container;
/**
* Reads GitHub Actions inputs from environment variables.
* GitHub Actions passes inputs as INPUT_<NAME> environment variables.
*/
function readInputs(): CliOptions {
const mapFile = process.env.INPUT_MAP_FILE;
const envFile = process.env.INPUT_ENV_FILE;
return {
map: mapFile,
envfile: envFile,
// GitHub Action only supports pull mode
push: false,
};
}
async function executeCommand(options: CliOptions): Promise<void> {
const commandHandler = serviceProvider.get<DispatchActionCommandHandler>(
TYPES.DispatchActionCommandHandler,
);
const command = DispatchActionCommand.fromCliOptions(options);
await commandHandler.handleCommand(command);
}
export async function main() {
const logger = serviceProvider?.get<ILogger>(TYPES.ILogger);
try {
const options = readInputs();
// Validate required inputs
if (!options.map || !options.envfile) {
throw new Error(
'🚨 Missing required inputs! Please provide map-file and env-file.',
);
}
logger?.info('🔑 Envilder GitHub Action - Starting secret pull...');
logger?.info(`📋 Map file: ${options.map}`);
logger?.info(`📄 Env file: ${options.envfile}`);
await executeCommand(options);
logger?.info('✅ Secrets pulled successfully!');
} catch (error) {
logger?.error('🚨 Uh-oh! Looks like Mario fell into the wrong pipe! 🍄💥');
logger?.error(error instanceof Error ? error.message : String(error));
throw error;
}
}
// Initialize the service provider
const startup = Startup.build();
startup.configureServices().configureInfrastructure();
serviceProvider = startup.create();
|