Skip to content

Commit 77e4172

Browse files
committed
start-proxy: get binary from toolcache
1 parent 4733419 commit 77e4172

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Diff for: lib/start-proxy-action.js

+11-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/start-proxy-action.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/start-proxy-action.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ import { ChildProcess, spawn } from "child_process";
22
import * as path from "path";
33

44
import * as core from "@actions/core";
5+
import * as toolcache from "@actions/tool-cache";
56
import { pki } from "node-forge";
67

78
import * as actionsUtil from "./actions-util";
89
import * as util from "./util";
910

11+
const UPDATEJOB_PROXY = "update-job-proxy";
12+
const UPDATEJOB_PROXY_VERSION = "v2.0.20240722180912";
13+
const UPDATEJOB_PROXY_URL =
14+
"https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.18.1/update-job-proxy.tar.gz";
1015
const PROXY_USER = "proxy_user";
1116
const KEY_SIZE = 2048;
1217
const KEY_EXPIRY_YEARS = 2;
@@ -106,7 +111,17 @@ async function runWrapper() {
106111
proxy_auth,
107112
};
108113
const host = "127.0.0.1";
109-
const proxyBin = path.resolve(__dirname, "..", "bin", "update-job-proxy");
114+
let proxyBin = toolcache.find(UPDATEJOB_PROXY, UPDATEJOB_PROXY_VERSION);
115+
if (!proxyBin) {
116+
const temp = await toolcache.downloadTool(UPDATEJOB_PROXY_URL);
117+
const extracted = await toolcache.extractTar(temp);
118+
proxyBin = await toolcache.cacheDir(
119+
extracted,
120+
UPDATEJOB_PROXY,
121+
UPDATEJOB_PROXY_VERSION,
122+
);
123+
}
124+
proxyBin = path.join(proxyBin, UPDATEJOB_PROXY);
110125
let port = 49152;
111126
try {
112127
let subprocess: ChildProcess | undefined = undefined;

0 commit comments

Comments
 (0)