mirror of
https://github.com/crazy-max/ghaction-import-gpg.git
synced 2024-11-29 08:21:06 -05:00
Cleanup code
This commit is contained in:
parent
3ff0e7f81d
commit
3b574952da
3 changed files with 6 additions and 27 deletions
18
dist/index.js
generated
vendored
18
dist/index.js
generated
vendored
|
@ -1065,7 +1065,7 @@ function run() {
|
|||
});
|
||||
}
|
||||
if (git_gpgsign) {
|
||||
core.info(`🔨 Configuring git committer to be ${git_committer_name} <${git_committer_email}>`);
|
||||
core.info(`🔨 Configuring Git committer (${git_committer_name} <${git_committer_email}>)`);
|
||||
if (git_committer_email != privateKey.email) {
|
||||
core.setFailed('Committer email does not match GPG key user address');
|
||||
return;
|
||||
|
@ -1073,8 +1073,8 @@ function run() {
|
|||
yield git.setConfig('user.name', git_committer_name);
|
||||
yield git.setConfig('user.email', git_committer_email);
|
||||
core.info('💎 Enable signing for this Git repository');
|
||||
yield git.enableCommitGpgsign();
|
||||
yield git.setUserSigningkey(privateKey.keyID);
|
||||
yield git.setConfig('commit.gpgsign', 'true');
|
||||
yield git.setConfig('user.signingkey', privateKey.keyID);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -1420,18 +1420,6 @@ const git = (args = []) => __awaiter(void 0, void 0, void 0, function* () {
|
|||
return res.stdout.trim();
|
||||
});
|
||||
});
|
||||
function enableCommitGpgsign() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield git(['config', 'commit.gpgsign', 'true']);
|
||||
});
|
||||
}
|
||||
exports.enableCommitGpgsign = enableCommitGpgsign;
|
||||
function setUserSigningkey(keyid) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield git(['config', 'user.signingkey', keyid]);
|
||||
});
|
||||
}
|
||||
exports.setUserSigningkey = setUserSigningkey;
|
||||
function getConfig(key) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield git(['config', key]);
|
||||
|
|
|
@ -9,14 +9,6 @@ const git = async (args: string[] = []): Promise<string> => {
|
|||
});
|
||||
};
|
||||
|
||||
export async function enableCommitGpgsign(): Promise<void> {
|
||||
await git(['config', 'commit.gpgsign', 'true']);
|
||||
}
|
||||
|
||||
export async function setUserSigningkey(keyid: string): Promise<void> {
|
||||
await git(['config', 'user.signingkey', keyid]);
|
||||
}
|
||||
|
||||
export async function getConfig(key: string): Promise<string> {
|
||||
return await git(['config', key]);
|
||||
}
|
||||
|
|
|
@ -60,18 +60,17 @@ async function run(): Promise<void> {
|
|||
}
|
||||
|
||||
if (git_gpgsign) {
|
||||
core.info(`🔨 Configuring git committer to be ${git_committer_name} <${git_committer_email}>`);
|
||||
core.info(`🔨 Configuring Git committer (${git_committer_name} <${git_committer_email}>)`);
|
||||
if (git_committer_email != privateKey.email) {
|
||||
core.setFailed('Committer email does not match GPG key user address');
|
||||
return;
|
||||
}
|
||||
|
||||
await git.setConfig('user.name', git_committer_name);
|
||||
await git.setConfig('user.email', git_committer_email);
|
||||
|
||||
core.info('💎 Enable signing for this Git repository');
|
||||
await git.enableCommitGpgsign();
|
||||
await git.setUserSigningkey(privateKey.keyID);
|
||||
await git.setConfig('commit.gpgsign', 'true');
|
||||
await git.setConfig('user.signingkey', privateKey.keyID);
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
|
Loading…
Reference in a new issue