feat: skip agent install and post step on subsequent runs for GitHub-hosted runners

This commit is contained in:
Varun Sharma
2025-12-07 22:01:18 -08:00
parent e152b90204
commit c51e8eeb6c
7 changed files with 21 additions and 2 deletions
+1
View File
@@ -32,6 +32,7 @@ inputs:
description: "Policy name to be used from the policy store"
required: false
default: ""
branding:
icon: "check-square"
color: "green"
+4
View File
@@ -32166,6 +32166,10 @@ var cleanup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
console.log(HARDEN_RUNNER_UNAVAILABLE_MESSAGE);
return;
}
if (isGithubHosted() && external_fs_.existsSync("/home/agent/post_event.json")) {
console.log("Post step already executed, skipping");
return;
}
external_fs_.writeFileSync("/home/agent/post_event.json", JSON.stringify({ event: "post" }));
const doneFile = "/home/agent/done.json";
let counter = 0;
+1 -1
View File
File diff suppressed because one or more lines are too long
+4
View File
@@ -85780,6 +85780,10 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
}
return;
}
if (isGithubHosted() && external_fs_.existsSync("/home/agent/agent.status")) {
console.log("Agent already installed, skipping installation");
return;
}
let _http = new lib.HttpClient();
let statusCode;
_http.requestOptions = { socketTimeout: 3 * 1000 };
+1 -1
View File
File diff suppressed because one or more lines are too long
+5
View File
@@ -48,6 +48,11 @@ import { context } from "@actions/github";
return;
}
if (isGithubHosted() && fs.existsSync("/home/agent/post_event.json")) {
console.log("Post step already executed, skipping");
return;
}
fs.writeFileSync(
"/home/agent/post_event.json",
JSON.stringify({ event: "post" })
+5
View File
@@ -263,6 +263,11 @@ interface MonitorResponse {
return;
}
if (isGithubHosted() && fs.existsSync("/home/agent/agent.status")) {
console.log("Agent already installed, skipping installation");
return;
}
let _http = new httpm.HttpClient();
let statusCode: number | undefined;
_http.requestOptions = { socketTimeout: 3 * 1000 };