From 3622e4d541c8adbc31c21017a7025ef418b94c09 Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Mon, 18 Mar 2024 13:43:58 -0700 Subject: [PATCH] This logs the SHA256 of the issued token. (#12) @imjasonh I have no idea how to test this? Signed-off-by: Matt Moore --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index f98527e..1e5998f 100644 --- a/index.js +++ b/index.js @@ -44,6 +44,11 @@ async function fetchWithRetry(url, options = {}, retries = 3, initialDelay = 100 if (!json2.token) { console.log(`::error::${json2.message}`); process.exit(1); } const tok = json2.token; + + const crypto = require('crypto'); + const tokHash = crypto.createHash('sha256').update(tok).digest('hex'); + console.log(`Token hash: ${tokHash}`); + console.log(`::add-mask::${tok}`); const fs = require('fs'); fs.appendFile(process.env.GITHUB_OUTPUT, `token=${tok}`, function (err) { if (err) throw err; }); // Write the output.