Add validation for post step (#3)

* work on fixing cache post step

* fix tests
This commit is contained in:
Dmitry Shibanov 2021-08-18 05:52:37 +03:00 committed by GitHub
parent 5f3f74c689
commit 53f73ba16b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 4 deletions

View file

@ -1,6 +1,7 @@
import * as core from '@actions/core';
import * as gpg from './gpg';
import * as constants from './constants';
import { isJobStatusSuccess } from './util';
import { save } from './cache';
async function removePrivateKeyFromKeychain() {
@ -20,8 +21,9 @@ async function removePrivateKeyFromKeychain() {
* @returns Promise that will be resolved when the save process finishes
*/
async function saveCache() {
const jobStatus = isJobStatusSuccess();
const cache = core.getInput(constants.INPUT_CACHE);
return cache ? save(cache) : Promise.resolve();
return jobStatus && cache ? save(cache) : Promise.resolve();
}
/**

View file

@ -69,3 +69,9 @@ export function getToolcachePath(toolName: string, version: string, architecture
return null;
}
export function isJobStatusSuccess() {
const jobStatus = core.getInput('job-status');
return jobStatus === 'success';
}