Skip to content

Commit

Permalink
Delete key using primary key ID not subkey ID
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Feb 28, 2022
1 parent 2724049 commit a7fb0ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
10 changes: 8 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions src/state-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

0 comments on commit a7fb0ed

Please sign in to comment.