Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 28 additions & 33 deletions github-action/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,39 +168,34 @@ export async function runMain(): Promise<void> {
return;
}

const execResult = await core.group(
'🚀 Run command in container',
async () => {
const args: DevContainerCliExecArgs = {
workspaceFolder,
configFile,
command: ['bash', '-c', runCommand],
env: inputEnvsWithDefaults,
userDataFolder,
};
let execLogString = '';
const execLog = (message: string): void => {
core.info(message);
if (!message.includes('@devcontainers/cli')) {
execLogString += message;
}
};
const exitCode = await devcontainer.exec(args, execLog);
if (exitCode !== 0) {
const errorMessage = `Dev container exec failed: (exit code: ${exitCode})`;
core.error(errorMessage);
core.setFailed(errorMessage);
}
core.setOutput('runCmdOutput', execLogString);
if (Buffer.byteLength(execLogString, 'utf-8') > 1000000) {
execLogString = truncate(execLogString, 999966);
execLogString += 'TRUNCATED TO 1 MB MAX OUTPUT SIZE';
}
core.setOutput('runCmdOutput', execLogString);
return exitCode;
},
);
if (execResult !== 0) {

const args: DevContainerCliExecArgs = {
workspaceFolder,
configFile,
command: ['bash', '-c', runCommand],
env: inputEnvsWithDefaults,
userDataFolder,
};
let execLogString = '';
const execLog = (message: string): void => {
core.info(message);
if (!message.includes('@devcontainers/cli')) {
execLogString += message;
}
};
const exitCode = await devcontainer.exec(args, execLog);
if (exitCode !== 0) {
const errorMessage = `Dev container exec failed: (exit code: ${exitCode})`;
core.error(errorMessage);
core.setFailed(errorMessage);
}
core.setOutput('runCmdOutput', execLogString);
if (Buffer.byteLength(execLogString, 'utf-8') > 1000000) {
execLogString = truncate(execLogString, 999966);
execLogString += 'TRUNCATED TO 1 MB MAX OUTPUT SIZE';
}
core.setOutput('runCmdOutput', execLogString);
if (exitCode !== 0) {
return;
}
} else {
Expand Down
Loading