Skip to content

Commit 274c82f

Browse files
authored
use .problemSiteData instead of removed .problemList, fixes workflow
1 parent a59cf38 commit 274c82f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/updateCompletionTable.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@ const PREPEND_PATH = process.argv[2] || './';
2323
const TEMPLATE_PATH = process.argv[3] || './README_template.md';
2424
const WRITE_PATH = process.argv[3] || './README.md';
2525

26-
const PROBLEMS_OBJ = JSON.parse(fs.readFileSync('./.problemList.json', 'utf8'));
26+
const PROBLEM_SITE_DATA = JSON.parse(fs.readFileSync('./.problemSiteData.json', 'utf8'));
27+
28+
function createProblemsObj(PROBLEM_SITE_DATA) {
29+
let PROBLEMS_OBJ = {}
30+
for (const {problem, pattern, link, code} of PROBLEM_SITE_DATA) {
31+
if (!(pattern in PROBLEMS_OBJ)) PROBLEMS_OBJ[pattern] = []
32+
PROBLEMS_OBJ[pattern].push([problem, "https://leetcode.com/problems/" + link, code.slice(0, 4)])
33+
}
34+
return PROBLEMS_OBJ
35+
}
36+
37+
const PROBLEMS_OBJ = createProblemsObj(PROBLEM_SITE_DATA)
2738

2839
const getDirectories = (source) =>
2940
readdirSync(source, { withFileTypes: true })

0 commit comments

Comments
 (0)