Skip to content

Commit 48def2d

Browse files
separate file for solution and question
1 parent 1fb8c60 commit 48def2d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/action.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,21 @@ async function commit(params) {
5757
}
5858

5959
const prefix = !!destinationFolder ? `${destinationFolder}/` : '';
60-
const path = `${prefix}problems/${name}/solution.md` // Markdown file for the problem with the solution at the end
60+
const questionPath = `${prefix}problems/${name}/question.md`; // Markdown file for the problem with question data
61+
const solutionPath = `${prefix}problems/${name}/solution.${LANG_TO_EXTENSION[submission.lang]}`; // Separate file for the solution
62+
6163

6264
const treeData = [
6365
{
64-
path,
66+
path: questionPath,
6567
mode: '100644',
66-
content: question_data + '\n \n ' + '# Solution' + '\n' + '```' + submission.lang + ' \n' + submission.code + '\n' + '```',
67-
}
68+
content: question_data,
69+
},
70+
{
71+
path: solutionPath,
72+
mode: '100644',
73+
content: submission.code,
74+
},
6875
];
6976

7077
const treeResponse = await octokit.git.createTree({

0 commit comments

Comments
 (0)