Skip to content

Commit

Permalink
src/gpg.ts: Use @actions/exec instead of promisify-child-process
Browse files Browse the repository at this point in the history
Remove the dependency on promisify-child-process by using the exec
function provided by @actions/exec.

Signed-off-by: Andrei Horodniceanu <[email protected]>
  • Loading branch information
the-horo committed Jul 14, 2024
1 parent 82a56b5 commit 15a7258
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 58 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

43 changes: 0 additions & 43 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"@actions/core": "^1.2.6",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.6.1",
"promisify-child-process": "^3.1.4",
"typed-rest-client": "^1.8.4"
},
"devDependencies": {
Expand Down
18 changes: 6 additions & 12 deletions src/gpg.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as tc from '@actions/tool-cache';
import { spawn } from 'promisify-child-process';
import * as exec from '@actions/exec'

// hack to workaround gpg on windows interaction with paths
function win_path_to_msys(path: string) {
Expand All @@ -16,22 +16,16 @@ export async function verify(file_path: string, sig_url: string) {
keyring = win_path_to_msys(keyring);
let sig_path = await tc.downloadTool(sig_url);
sig_path = win_path_to_msys(sig_path);
const gpg_process = <any> spawn(
'gpg',
await exec.exec(
'gpg',
[ '--lock-never', '--verify', '--keyring', keyring, '--no-default-keyring',
sig_path, file_path ],
{}
);
gpg_process.stderr.pipe(process.stdout);
gpg_process.stdout.pipe(process.stdout);
// will throw for non-0 exit status
await gpg_process;
sig_path, file_path ]
)
}

export async function install() {
// other platforms have gpg pre-installed
if (process.platform == "darwin") {
const brew_process = <any> spawn('brew', [ 'install', 'gnupg' ], {});
await brew_process;
await exec.exec('brew', [ 'install', 'gnupg' ])
}
}

0 comments on commit 15a7258

Please sign in to comment.