Skip to content

Commit

Permalink
Merge pull request #5 from rcowsill/feat/stop-commands
Browse files Browse the repository at this point in the history
Block unexpected workflow commands
  • Loading branch information
hmarr authored Oct 10, 2021
2 parents 0f23c54 + 3042c8d commit 1201a20
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
const fs = require("fs");
const crypto = require("crypto");

const resumeToken = crypto.randomBytes(30).toString("base64")

// Output environment variables. Secrets are automatically masked.
console.log("::group::Environment variables")
console.log(`::stop-commands::${resumeToken}`)

for (const [key, value] of Object.entries(process.env).sort()) {
console.log(`${key}=${value}`);
}

console.log(`::${resumeToken}::`)
console.log("::endgroup::")

// Output prettified event JSON.
console.log("::group::Event JSON")
console.log(`::stop-commands::${resumeToken}`)

const event = JSON.parse(fs.readFileSync(process.env["GITHUB_EVENT_PATH"]));
console.log(JSON.stringify(event, null, 2));

console.log(`::${resumeToken}::`)
console.log("::endgroup::")

0 comments on commit 1201a20

Please sign in to comment.