= new Promise((resolve) => {
setTimeout(() => {
- onTimeout();
+ if (!finished) onTimeout();
resolve(undefined);
}, timeoutMs);
});
- return await Promise.race([promise, timeout]);
+ return await Promise.race([mainTask(), timeout]);
+}
+
+/**
+ * This function implements a heuristic to determine whether the
+ * runner we are on is hosted by GitHub. It does this by checking
+ * the name of the runner against the list of known GitHub-hosted
+ * runner names. It also checks for the presence of a toolcache
+ * directory with the name hostedtoolcache which is present on
+ * GitHub-hosted runners.
+ *
+ * @returns true iff the runner is hosted by GitHub
+ */
+export function isHostedRunner() {
+ return (
+ // Name of the runner on hosted Windows runners
+ process.env["RUNNER_NAME"]?.includes("Hosted Agent") ||
+ // Name of the runner on hosted POSIX runners
+ process.env["RUNNER_NAME"]?.includes("GitHub Actions") ||
+ // Segment of the path to the tool cache on all hosted runners
+ process.env["RUNNER_TOOL_CACHE"]?.includes("hostedtoolcache")
+ );
}
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy