Cleanup code

This commit is contained in:
CrazyMax 2020-05-06 00:27:45 +02:00
parent 3ff0e7f81d
commit 3b574952da
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
3 changed files with 6 additions and 27 deletions

18
dist/index.js generated vendored
View file

@ -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]);

View file

@ -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]);
}

View file

@ -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);