Skip to content

Commit

Permalink
This logs the SHA256 of the issued token. (#12)
Browse files Browse the repository at this point in the history
@imjasonh I have no idea how to test this?

Signed-off-by: Matt Moore <[email protected]>
  • Loading branch information
mattmoor authored Mar 18, 2024
1 parent 60c0a50 commit 3622e4d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3622e4d

Please sign in to comment.