This commit is contained in:
CrazyMax 2020-05-06 18:00:13 +02:00
parent 600f5e2059
commit 517f62fc0c
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
8 changed files with 34 additions and 35 deletions

View file

@ -32,3 +32,11 @@ jobs:
-
name: Test
run: npm run test
-
# https://github.com/codecov/codecov-action
name: Upload coverage
uses: codecov/codecov-action@v1
if: success()
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/clover.xml

View file

@ -1,5 +1,5 @@
{
"printWidth": 120,
"printWidth": 240,
"tabWidth": 2,
"useTabs": false,
"semi": true,

View file

@ -1,6 +1,7 @@
[![GitHub release](https://img.shields.io/github/release/crazy-max/ghaction-import-gpg.svg?style=flat-square)](https://github.com/crazy-max/ghaction-import-gpg/releases/latest)
[![GitHub marketplace](https://img.shields.io/badge/marketplace-import--gpg-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/import-gpg)
[![Test workflow](https://github.com/crazy-max/ghaction-import-gpg/workflows/test/badge.svg)](https://github.com/crazy-max/ghaction-import-gpg/actions?workflow=test)
[![Codecov](https://codecov.io/gh/crazy-max/ghaction-import-gpg/workflows/test/badge.svg)](https://codecov.io/gh/crazy-max/ghaction-import-gpg)
[![Become a sponsor](https://img.shields.io/badge/sponsor-crazy--max-181717.svg?logo=github&style=flat-square)](https://github.com/sponsors/crazy-max)
[![Paypal Donate](https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal&style=flat-square)](https://www.paypal.me/crazyws)

16
dist/index.js generated vendored
View file

@ -985,7 +985,7 @@ exports.IsPost = !!process.env['STATE_isPost'];
if (!exports.IsPost) {
coreCommand.issueCommand('save-state', { name: 'isPost' }, 'true');
}
//# sourceMappingURL=state-helper.js.map
/***/ }),
@ -1114,7 +1114,7 @@ if (!stateHelper.IsPost) {
else {
cleanup();
}
//# sourceMappingURL=main.js.map
/***/ }),
@ -1245,9 +1245,7 @@ exports.importKey = (armoredText) => __awaiter(void 0, void 0, void 0, function*
});
});
exports.getKeygrip = (fingerprint) => __awaiter(void 0, void 0, void 0, function* () {
return yield exec
.exec('gpg', ['--batch', '--with-colons', '--with-keygrip', '--list-secret-keys', fingerprint], true)
.then(res => {
return yield exec.exec('gpg', ['--batch', '--with-colons', '--with-keygrip', '--list-secret-keys', fingerprint], true).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
}
@ -1289,7 +1287,7 @@ exports.deleteKey = (fingerprint) => __awaiter(void 0, void 0, void 0, function*
exports.killAgent = () => __awaiter(void 0, void 0, void 0, function* () {
yield gpgConnectAgent('KILLAGENT');
});
//# sourceMappingURL=gpg.js.map
/***/ }),
@ -1442,7 +1440,7 @@ function setConfig(key, value) {
});
}
exports.setConfig = setConfig;
//# sourceMappingURL=git.js.map
/***/ }),
@ -45691,7 +45689,7 @@ exports.generateKeyPair = (name, email, passphrase, numBits = 4096) => __awaiter
privateKey: keyPair.privateKeyArmored.replace(/\r\n/g, '\n').trim()
};
});
//# sourceMappingURL=openpgp.js.map
/***/ }),
@ -45740,7 +45738,7 @@ exports.exec = (command, args = [], silent) => __awaiter(void 0, void 0, void 0,
stderr: stderr.trim()
};
});
//# sourceMappingURL=exec.js.map
/***/ }),

View file

@ -124,21 +124,19 @@ export const importKey = async (armoredText: string): Promise<string> => {
};
export const getKeygrip = async (fingerprint: string): Promise<string> => {
return await exec
.exec('gpg', ['--batch', '--with-colons', '--with-keygrip', '--list-secret-keys', fingerprint], true)
.then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
return await exec.exec('gpg', ['--batch', '--with-colons', '--with-keygrip', '--list-secret-keys', fingerprint], true).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
}
let keygrip: string = '';
for (let line of res.stdout.replace(/\r/g, '').trim().split(/\n/g)) {
if (line.startsWith('grp')) {
keygrip = line.replace(/(grp|:)/g, '').trim();
break;
}
let keygrip: string = '';
for (let line of res.stdout.replace(/\r/g, '').trim().split(/\n/g)) {
if (line.startsWith('grp')) {
keygrip = line.replace(/(grp|:)/g, '').trim();
break;
}
}
return keygrip;
});
}
return keygrip;
});
};
export const configureAgent = async (config: string): Promise<void> => {

View file

@ -15,10 +15,8 @@ async function run(): Promise<void> {
const git_commit_gpgsign = /true/i.test(core.getInput('git_commit_gpgsign'));
const git_tag_gpgsign = /true/i.test(core.getInput('git_tag_gpgsign'));
const git_push_gpgsign = /true/i.test(core.getInput('git_push_gpgsign'));
const git_committer_name: string =
core.getInput('git_committer_name') || process.env['GITHUB_ACTOR'] || 'github-actions';
const git_committer_email: string =
core.getInput('git_committer_email') || `${git_committer_name}@users.noreply.github.com`;
const git_committer_name: string = core.getInput('git_committer_name') || process.env['GITHUB_ACTOR'] || 'github-actions';
const git_committer_email: string = core.getInput('git_committer_email') || `${git_committer_name}@users.noreply.github.com`;
core.info('📣 GnuPG info');
const version = await gpg.getVersion();

View file

@ -39,12 +39,7 @@ export const readPrivateKey = async (armoredText: string): Promise<PrivateKey> =
};
};
export const generateKeyPair = async (
name: string,
email: string,
passphrase: string,
numBits: number = 4096
): Promise<KeyPair> => {
export const generateKeyPair = async (name: string, email: string, passphrase: string, numBits: number = 4096): Promise<KeyPair> => {
const keyPair = await openpgp.generateKey({
userIds: [{name: name, email: email}],
numBits,

View file

@ -11,7 +11,8 @@
"rootDir": "./src",
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true
"esModuleInterop": true,
"sourceMap": true
},
"exclude": ["node_modules", "**/*.test.ts"]
}