@@ -36,7 +36,7 @@ function normalizeName(problemName) {
3636 return problemName . toLowerCase ( ) . replace ( / \s / g, '_' ) ;
3737}
3838
39- async function commit ( octokit , user , owner , repo , defaultBranch , commitInfo , treeSHA , latestCommitSHA , submission ) {
39+ async function commit ( octokit , destinationFolder , owner , repo , defaultBranch , commitInfo , treeSHA , latestCommitSHA , submission ) {
4040 const name = normalizeName ( submission . title ) ;
4141 log ( `Committing solution for ${ name } ...` ) ;
4242
@@ -46,7 +46,7 @@ async function commit(octokit, user, owner, repo, defaultBranch, commitInfo, tre
4646
4747 const treeData = [
4848 {
49- path : `${ user } /problems/${ name } /solution.${ LANG_TO_EXTENSION [ submission . lang ] } ` ,
49+ path : `${ destinationFolder } /problems/${ name } /solution.${ LANG_TO_EXTENSION [ submission . lang ] } ` ,
5050 mode : '100644' ,
5151 content : submission . code ,
5252 }
@@ -115,7 +115,7 @@ function addToSubmissions(response, lastTimestamp, filterDuplicateSecs, submissi
115115 return true ;
116116}
117117
118- async function sync ( user , githubToken , owner , repo , filterDuplicateSecs , leetcodeCSRFToken , leetcodeSession ) {
118+ async function sync ( destinationFolder , githubToken , owner , repo , filterDuplicateSecs , leetcodeCSRFToken , leetcodeSession ) {
119119 const octokit = new Octokit ( {
120120 auth : githubToken ,
121121 userAgent : 'LeetCode sync to GitHub - GitHub Action' ,
@@ -205,21 +205,21 @@ async function sync(user, githubToken, owner, repo, filterDuplicateSecs, leetcod
205205 let treeSHA = commits . data [ 0 ] . commit . tree . sha ;
206206 for ( i = submissions . length - 1 ; i >= 0 ; i -- ) {
207207 submission = submissions [ i ] ;
208- [ treeSHA , latestCommitSHA ] = await commit ( octokit , user , owner , repo , defaultBranch , commitInfo , treeSHA , latestCommitSHA , submission ) ;
208+ [ treeSHA , latestCommitSHA ] = await commit ( octokit , destinationFolder , owner , repo , defaultBranch , commitInfo , treeSHA , latestCommitSHA , submission ) ;
209209 }
210210 log ( 'Done syncing all submissions.' ) ;
211211}
212212
213213async function main ( ) {
214- const user = core . getInput ( 'user ' ) ;
214+ const destinationFolder = core . getInput ( 'destination-folder ' ) ;
215215 const githubToken = core . getInput ( 'github-token' ) ;
216216 const owner = context . repo . owner ;
217217 const repo = context . repo . repo ;
218218 const leetcodeCSRFToken = core . getInput ( 'leetcode-csrf-token' ) ;
219219 const leetcodeSession = core . getInput ( 'leetcode-session' ) ;
220220 const filterDuplicateSecs = core . getInput ( 'filter-duplicate-secs' ) ;
221221
222- await sync ( user , githubToken , owner , repo , filterDuplicateSecs , leetcodeCSRFToken , leetcodeSession ) ;
222+ await sync ( destinationFolder , githubToken , owner , repo , filterDuplicateSecs , leetcodeCSRFToken , leetcodeSession ) ;
223223}
224224
225225main ( ) . catch ( ( error ) => {
0 commit comments