Skip to content

Commit

Permalink
Merge pull request #20 from step-security/feature-16
Browse files Browse the repository at this point in the history
Add color and move link to new line
  • Loading branch information
varunsh-coder authored Nov 26, 2021
2 parents 7206db2 + b1777d5 commit 9bba600
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 38 deletions.
59 changes: 35 additions & 24 deletions dist/index.js

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

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

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

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

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

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

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

9 changes: 8 additions & 1 deletion dist/pre/index.js

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

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as fs from "fs";
while (true) {
if (!fs.existsSync(doneFile)) {
counter++;
if (counter > 30) {
if (counter > 10) {
console.log("timed out");

break;
Expand Down
10 changes: 10 additions & 0 deletions src/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export function printInfo(web_url) {
console.log(
"\x1b[32m%s\x1b[0m",
"View security insights and recommended policy at:"
);

console.log(
`${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]}`
);
}
7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { printInfo } from "./common";

(async () => {
if (process.platform !== "linux") {
console.log("Only runs on linux");
return;
}

var web_url = "https://app.stepsecurity.io";

console.log(
`View security insights and recommended policy at ${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]} after the run has finished`
);
printInfo(web_url);
})();
7 changes: 3 additions & 4 deletions src/setup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as core from "@actions/core";
import { context } from "@actions/github/lib/utils";
import * as cp from "child_process";
import * as fs from "fs";
import * as https from "https";
import * as path from "path";
import { v4 as uuidv4 } from "uuid";
import { printInfo } from "./common";

(async () => {
try {
Expand Down Expand Up @@ -43,9 +43,8 @@ import { v4 as uuidv4 } from "uuid";
filePath.close();

console.log(`Step Security Job Correlation ID: ${correlation_id}`);
console.log(
`View security insights and recommended policy at ${web_url}/github/${process.env["GITHUB_REPOSITORY"]}/actions/runs/${process.env["GITHUB_RUN_ID"]} after the run has finished`
);
printInfo(web_url);

let cmd = "cp",
args = [path.join(__dirname, "agent"), "/home/agent/agent"];
cp.execFileSync(cmd, args);
Expand Down

0 comments on commit 9bba600

Please sign in to comment.