1
0
Fork 0
mirror of synced 2026-06-05 17:35:14 +00:00

Call monitor run

This commit is contained in:
Varun Sharma 2021-11-30 14:16:09 -08:00
commit 0a4cdd6afa
5 changed files with 19 additions and 7 deletions

7
dist/pre/index.js vendored
View file

@ -6235,6 +6235,8 @@ var core = __nccwpck_require__(2186);
var external_child_process_ = __nccwpck_require__(3129);
// EXTERNAL MODULE: external "fs"
var external_fs_ = __nccwpck_require__(5747);
// EXTERNAL MODULE: ./node_modules/@actions/http-client/index.js
var http_client = __nccwpck_require__(9925);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(5622);
// EXTERNAL MODULE: ./node_modules/uuid/dist/index.js
@ -6276,6 +6278,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
(() => __awaiter(void 0, void 0, void 0, function* () {
try {
if (process.platform !== "linux") {
@ -6286,6 +6289,8 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
var env = "agent";
var api_url = `https://${env}.api.stepsecurity.io/v1`;
var web_url = "https://app.stepsecurity.io";
let _http = new http_client.HttpClient();
yield _http.get(`${api_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}/monitor`);
const confg = {
repo: process.env["GITHUB_REPOSITORY"],
run_id: process.env["GITHUB_RUN_ID"],
@ -6297,7 +6302,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
const confgStr = JSON.stringify(confg);
external_child_process_.execSync("sudo mkdir -p /home/agent");
external_child_process_.execSync("sudo chown -R $USER /home/agent");
const downloadPath = yield tool_cache.downloadTool("https://github.com/step-security/agent/releases/download/v0.1.5/agent_0.1.5_linux_amd64.tar.gz");
const downloadPath = yield tool_cache.downloadTool("https://github.com/step-security/agent/releases/download/v0.2.0/agent_0.2.0_linux_amd64.tar.gz");
const extractPath = yield tool_cache.extractTar(downloadPath);
console.log(`Step Security Job Correlation ID: ${correlation_id}`);
printInfo(web_url);

File diff suppressed because one or more lines are too long

5
package-lock.json generated
View file

@ -1,17 +1,18 @@
{
"name": "step-security-harden-runner",
"version": "0.1.0",
"version": "0.3.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "step-security-harden-runner",
"version": "0.1.0",
"version": "0.3.0",
"license": "Apache License 2.0",
"dependencies": {
"@actions/core": "^1.5.0",
"@actions/exec": "^1.1.0",
"@actions/github": "^5.0.0",
"@actions/http-client": "^1.0.11",
"@actions/tool-cache": "^1.7.1",
"node-fetch": "^2.6.1",
"uuid": "^8.3.2"

View file

@ -1,6 +1,6 @@
{
"name": "step-security-harden-runner",
"version": "0.3.0",
"version": "0.4.0",
"description": "GitHub Actions Runtime Security",
"main": "index.js",
"scripts": {
@ -25,6 +25,7 @@
"@actions/core": "^1.5.0",
"@actions/exec": "^1.1.0",
"@actions/github": "^5.0.0",
"@actions/http-client": "^1.0.11",
"@actions/tool-cache": "^1.7.1",
"node-fetch": "^2.6.1",
"uuid": "^8.3.2"

View file

@ -1,7 +1,7 @@
import * as core from "@actions/core";
import * as cp from "child_process";
import * as fs from "fs";
import * as https from "https";
import * as httpm from "@actions/http-client";
import * as path from "path";
import { v4 as uuidv4 } from "uuid";
import { printInfo } from "./common";
@ -19,6 +19,11 @@ import * as tc from "@actions/tool-cache";
var api_url = `https://${env}.api.stepsecurity.io/v1`;
var web_url = "https://app.stepsecurity.io";
let _http = new httpm.HttpClient();
await _http.get(
`${api_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}/monitor`
);
const confg = {
repo: process.env["GITHUB_REPOSITORY"],
run_id: process.env["GITHUB_RUN_ID"],
@ -33,7 +38,7 @@ import * as tc from "@actions/tool-cache";
cp.execSync("sudo chown -R $USER /home/agent");
const downloadPath: string = await tc.downloadTool(
"https://github.com/step-security/agent/releases/download/v0.1.5/agent_0.1.5_linux_amd64.tar.gz"
"https://github.com/step-security/agent/releases/download/v0.2.0/agent_0.2.0_linux_amd64.tar.gz"
);
const extractPath = await tc.extractTar(downloadPath);