1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00

output logs

This commit is contained in:
shimataro 2023-10-11 11:12:55 +09:00
parent df107d88c4
commit b648d7324c
No known key found for this signature in database
GPG key ID: BE92C05736911A9D
6 changed files with 44 additions and 41 deletions

60
dist/main.js vendored

File diff suppressed because one or more lines are too long

6
dist/main.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/post.js vendored

File diff suppressed because one or more lines are too long

6
dist/post.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -104,7 +104,7 @@ export function main(): void {
console.log(`SSH key has been stored to ${sshDirName} successfully.`);
if (backedUpFileNames.length > 0) {
console.log(`Following files are backed up in suffix "${backupSuffix}"; ${backedUpFileNames.join(", ")}`);
console.log(`Following files has been backed up in suffix "${backupSuffix}"; ${backedUpFileNames.join(", ")}`);
}
}

View file

@ -25,9 +25,10 @@ export function post(): void {
console.log(`SSH key in ${sshDirName} has been removed successfully.`);
} else {
// remove created files and restore from backup
removeCreatedFiles(sshDirName);
const removedFileNames = removeCreatedFiles(sshDirName);
const restoredFileNames = restoreFiles(sshDirName, backupSuffix);
console.log(`Following files in suffix "${backupSuffix}" are restored; ${restoredFileNames.join(", ")}`);
console.log(`Following files has been removed; ${removedFileNames.join(", ")}`);
console.log(`Following files in suffix "${backupSuffix}" has been restored; ${restoredFileNames.join(", ")}`);
}
}
@ -45,14 +46,16 @@ function removeDirectory(dirName: string): void {
/**
* remove created files in main phase
* @param dirName directory name
* @returns removed file names
*/
function removeCreatedFiles(dirName: string): void {
function removeCreatedFiles(dirName: string): string[] {
const createdFileNames = common.loadCreatedFileNames();
for (const fileName of createdFileNames) {
const pathName = path.join(dirName, fileName);
fs.rmSync(pathName);
}
return createdFileNames;
}
/**