-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from rcowsill/feat/stop-commands
Block unexpected workflow commands
- Loading branch information
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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::") |