mirror of
https://github.com/crazy-max/ghaction-import-gpg.git
synced 2024-11-22 04:50:56 -05:00
Codecov
This commit is contained in:
parent
600f5e2059
commit
517f62fc0c
8 changed files with 34 additions and 35 deletions
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
|
@ -32,3 +32,11 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
run: npm run 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
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"printWidth": 120,
|
"printWidth": 240,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
|
|
|
@ -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 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)
|
[![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)
|
[![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)
|
[![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)
|
[![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
16
dist/index.js
generated
vendored
|
@ -985,7 +985,7 @@ exports.IsPost = !!process.env['STATE_isPost'];
|
||||||
if (!exports.IsPost) {
|
if (!exports.IsPost) {
|
||||||
coreCommand.issueCommand('save-state', { name: 'isPost' }, 'true');
|
coreCommand.issueCommand('save-state', { name: 'isPost' }, 'true');
|
||||||
}
|
}
|
||||||
|
//# sourceMappingURL=state-helper.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
@ -1114,7 +1114,7 @@ if (!stateHelper.IsPost) {
|
||||||
else {
|
else {
|
||||||
cleanup();
|
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* () {
|
exports.getKeygrip = (fingerprint) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
return yield exec
|
return yield exec.exec('gpg', ['--batch', '--with-colons', '--with-keygrip', '--list-secret-keys', fingerprint], true).then(res => {
|
||||||
.exec('gpg', ['--batch', '--with-colons', '--with-keygrip', '--list-secret-keys', fingerprint], true)
|
|
||||||
.then(res => {
|
|
||||||
if (res.stderr != '' && !res.success) {
|
if (res.stderr != '' && !res.success) {
|
||||||
throw new Error(res.stderr);
|
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* () {
|
exports.killAgent = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
yield gpgConnectAgent('KILLAGENT');
|
yield gpgConnectAgent('KILLAGENT');
|
||||||
});
|
});
|
||||||
|
//# sourceMappingURL=gpg.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
@ -1442,7 +1440,7 @@ function setConfig(key, value) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.setConfig = setConfig;
|
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()
|
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()
|
stderr: stderr.trim()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
//# sourceMappingURL=exec.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
|
26
src/gpg.ts
26
src/gpg.ts
|
@ -124,21 +124,19 @@ export const importKey = async (armoredText: string): Promise<string> => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getKeygrip = async (fingerprint: string): Promise<string> => {
|
export const getKeygrip = async (fingerprint: string): Promise<string> => {
|
||||||
return await exec
|
return await exec.exec('gpg', ['--batch', '--with-colons', '--with-keygrip', '--list-secret-keys', fingerprint], true).then(res => {
|
||||||
.exec('gpg', ['--batch', '--with-colons', '--with-keygrip', '--list-secret-keys', fingerprint], true)
|
if (res.stderr != '' && !res.success) {
|
||||||
.then(res => {
|
throw new Error(res.stderr);
|
||||||
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)) {
|
return keygrip;
|
||||||
if (line.startsWith('grp')) {
|
});
|
||||||
keygrip = line.replace(/(grp|:)/g, '').trim();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return keygrip;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const configureAgent = async (config: string): Promise<void> => {
|
export const configureAgent = async (config: string): Promise<void> => {
|
||||||
|
|
|
@ -15,10 +15,8 @@ async function run(): Promise<void> {
|
||||||
const git_commit_gpgsign = /true/i.test(core.getInput('git_commit_gpgsign'));
|
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_tag_gpgsign = /true/i.test(core.getInput('git_tag_gpgsign'));
|
||||||
const git_push_gpgsign = /true/i.test(core.getInput('git_push_gpgsign'));
|
const git_push_gpgsign = /true/i.test(core.getInput('git_push_gpgsign'));
|
||||||
const git_committer_name: string =
|
const git_committer_name: string = core.getInput('git_committer_name') || process.env['GITHUB_ACTOR'] || 'github-actions';
|
||||||
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_email: string =
|
|
||||||
core.getInput('git_committer_email') || `${git_committer_name}@users.noreply.github.com`;
|
|
||||||
|
|
||||||
core.info('📣 GnuPG info');
|
core.info('📣 GnuPG info');
|
||||||
const version = await gpg.getVersion();
|
const version = await gpg.getVersion();
|
||||||
|
|
|
@ -39,12 +39,7 @@ export const readPrivateKey = async (armoredText: string): Promise<PrivateKey> =
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const generateKeyPair = async (
|
export const generateKeyPair = async (name: string, email: string, passphrase: string, numBits: number = 4096): Promise<KeyPair> => {
|
||||||
name: string,
|
|
||||||
email: string,
|
|
||||||
passphrase: string,
|
|
||||||
numBits: number = 4096
|
|
||||||
): Promise<KeyPair> => {
|
|
||||||
const keyPair = await openpgp.generateKey({
|
const keyPair = await openpgp.generateKey({
|
||||||
userIds: [{name: name, email: email}],
|
userIds: [{name: name, email: email}],
|
||||||
numBits,
|
numBits,
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true,
|
||||||
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": ["node_modules", "**/*.test.ts"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue