| 5 | import {save} from './cache'; |
| 6 | |
| 7 | async function removePrivateKeyFromKeychain() { |
| 8 | if (core.getInput(constants.INPUT_GPG_PRIVATE_KEY, {required: false})) { |
| 9 | core.info('Removing private key from keychain'); |
| 10 | try { |
| 11 | const keyFingerprint = core.getState( |
| 12 | constants.STATE_GPG_PRIVATE_KEY_FINGERPRINT |
| 13 | ); |
| 14 | await gpg.deleteKey(keyFingerprint); |
| 15 | } catch (error) { |
| 16 | core.setFailed( |
| 17 | `Failed to remove private key due to: ${(error as Error).message}` |
| 18 | ); |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Check given input and run a save process for the specified package manager |