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

fix; files that didn't backed up is not removed in "post" phase (#256)

* fix; files that didn't backed up is not removed in "post" phase

* output logs

* output log in main phase

* update log text

* update log text

* create directory only if not exist

* amend step name
This commit is contained in:
shimataro 2023-10-11 16:20:54 +09:00 committed by GitHub
parent ab731d2fcd
commit ccfb951a8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 127 additions and 75 deletions

View file

@ -6,6 +6,7 @@ import * as core from "@actions/core";
/** state name of backup suffix */
const STATE_BACKUP_SUFFIX = "backup-suffix";
const STATE_CREATED_FILES = "created-files";
/**
* create backup suffix name
@ -31,6 +32,24 @@ export function getBackupSuffix(): string {
return core.getState(STATE_BACKUP_SUFFIX);
}
/**
* save created file names
* @param fileNames array of file names
*/
export function saveCreatedFileNames(fileNames: string[]): void {
const json = JSON.stringify(fileNames);
core.saveState(STATE_CREATED_FILES, json);
}
/**
* save created file names
* @returns saved array of file names
*/
export function loadCreatedFileNames(): string[] {
const json = core.getState(STATE_CREATED_FILES);
return JSON.parse(json) as string[];
}
/**
* get SSH directory
* @returns SSH directory name