Delete key using primary key ID not subkey ID (#125)

This commit is contained in:
Jose Celano 2022-02-28 15:53:00 +00:00 committed by GitHub
parent 2724049ae2
commit baa427b5b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

10
dist/index.js generated vendored
View file

@ -444,6 +444,7 @@ function run() {
fingerprint = inputs.fingerprint;
}
stateHelper.setFingerprint(fingerprint);
stateHelper.setKeyID(privateKey.keyID);
yield core.group(`Fingerprint to use`, () => __awaiter(this, void 0, void 0, function* () {
core.info(fingerprint);
}));
@ -526,7 +527,7 @@ function cleanup() {
}
try {
core.info('Removing keys');
yield gpg.deleteKey(stateHelper.fingerprint);
yield gpg.deleteKey(stateHelper.keyId);
core.info('Killing GnuPG agent');
yield gpg.killAgent();
}
@ -644,14 +645,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setFingerprint = exports.fingerprint = exports.IsPost = void 0;
exports.setKeyID = exports.setFingerprint = exports.keyId = exports.fingerprint = exports.IsPost = void 0;
const core = __importStar(__webpack_require__(2186));
exports.IsPost = !!process.env['STATE_isPost'];
exports.fingerprint = process.env['STATE_fingerprint'] || '';
exports.keyId = process.env['STATE_keyId'] || '';
function setFingerprint(fingerprint) {
core.saveState('fingerprint', fingerprint);
}
exports.setFingerprint = setFingerprint;
function setKeyID(keyID) {
core.saveState('keyId', keyID);
}
exports.setKeyID = setKeyID;
if (!exports.IsPost) {
core.saveState('isPost', 'true');
}

View file

@ -38,6 +38,7 @@ async function run(): Promise<void> {
fingerprint = inputs.fingerprint;
}
stateHelper.setFingerprint(fingerprint);
stateHelper.setKeyID(privateKey.keyID);
await core.group(`Fingerprint to use`, async () => {
core.info(fingerprint);
});
@ -131,7 +132,7 @@ async function cleanup(): Promise<void> {
}
try {
core.info('Removing keys');
await gpg.deleteKey(stateHelper.fingerprint);
await gpg.deleteKey(stateHelper.keyId);
core.info('Killing GnuPG agent');
await gpg.killAgent();

View file

@ -2,11 +2,16 @@ import * as core from '@actions/core';
export const IsPost = !!process.env['STATE_isPost'];
export const fingerprint = process.env['STATE_fingerprint'] || '';
export const keyId = process.env['STATE_keyId'] || '';
export function setFingerprint(fingerprint: string) {
core.saveState('fingerprint', fingerprint);
}
export function setKeyID(keyID: string) {
core.saveState('keyId', keyID);
}
if (!IsPost) {
core.saveState('isPost', 'true');
}