@@ -5,7 +5,7 @@ const fs = require("fs");
55
66const GITHUB_TOKEN = core . getInput ( "GITHUB_TOKEN" ) ;
77const FILE_PATH = core . getInput ( "image_path" ) || "./assets/tryhackme-badge.png" ;
8- const THM_USERNAME = core . getInput ( "username" ) || "dhanushnehru" ;
8+ // const THM_USERNAME = core.getInput("username") || "dhanushnehru";
99const THM_USER_ID = core . getInput ( "user_id" ) || "1995656" ;
1010
1111/*
@@ -15,6 +15,7 @@ const THM_USER_ID = core.getInput("user_id") || "1995656";
1515 * @param options {Object} extra options
1616 * @return {Promise<Object> }
1717 */
18+
1819const executeCommand = ( cmd , args = [ ] , options = { } ) =>
1920 new Promise ( ( resolve , reject ) => {
2021 let outputData = "" ;
@@ -61,10 +62,10 @@ const refreshBadge = async (userId) => {
6162 }
6263} ;
6364
64- const downloadAndCommitBadge = async ( githubToken , filePath , username ) => {
65+ const downloadAndCommitBadge = async ( githubToken , filePath , userID ) => {
6566 await refreshBadge ( THM_USER_ID ) ;
6667 try {
67- const url = `https://tryhackme-badges.s3.amazonaws. com/${ username } .png` ;
68+ const url = `https://tryhackme. com/api/v2/badges/public-profile?userPublicId= ${ userID } `
6869 const path = filePath ;
6970 const committerUsername = core . getInput ( "committer_username" ) ;
7071 const commitMessage = core . getInput ( "commit_message" ) || "Updated THM profile badge using action workflow by Dhanush Nehru" ;
@@ -101,4 +102,4 @@ const downloadAndCommitBadge = async (githubToken, filePath, username) => {
101102 }
102103} ;
103104
104- downloadAndCommitBadge ( GITHUB_TOKEN , FILE_PATH , THM_USERNAME ) ;
105+ downloadAndCommitBadge ( GITHUB_TOKEN , FILE_PATH , THM_USER_ID ) ;
0 commit comments