Skip to content

Commit 80b2998

Browse files
author
lucifer
committed
feat: daily problem
1 parent 73e0430 commit 80b2998

File tree

5 files changed

+302
-5
lines changed

5 files changed

+302
-5
lines changed

.github/workflows/schedule.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ jobs:
1212
env:
1313
issueToken: ${{secrets.issueToken}}
1414
run: npm run daily-schedule
15+
- name: Commit static
16+
run: |
17+
git config --global user.name 'robot'
18+
git commit -am "feat: from daily schedule"
19+
git push

schedule/daily-check.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const { Octokit } = require("@octokit/rest");
22
const fs = require("fs");
3+
const path = require("path");
34
const { getDay } = require("../utils/day");
45
const { owner, repo } = require("../config/index");
6+
57
const solutions = require("../static/solution/solutions.json");
68
const mySolutions = require("../static/my/solutions.json");
79

@@ -29,7 +31,7 @@ if (problem && problem.issue_number) {
2931
});
3032

3133
fs.writeFileSync(
32-
"../static/my/solutions.json",
34+
path.resolve(__dirname, "../static/my/solutions.json"),
3335
JSON.stringify(mySolutions)
3436
);
3537
});

schedule/daily-problem.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
const { Octokit } = require("@octokit/rest");
22
const fs = require("fs");
3+
const path = require("path");
34
const { getDay } = require("../utils/day");
45
const { owner, repo } = require("../config/index");
6+
57
const solutions = require("../static/solution/solutions.json");
8+
69
const octokit = new Octokit({ auth: process.env.issueToken });
710

811
const solution = solutions[getDay()];
@@ -48,7 +51,7 @@ async function run() {
4851
solution.issue_number = data.number;
4952

5053
fs.writeFileSync(
51-
"../static/solution/solutions.json",
54+
path.resolve(__dirname, "../static/solution/solutions.json"),
5255
JSON.stringify(solutions)
5356
);
5457
}

static/my/solutions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
{
88
"title": "232. 用栈实现队列",
99
"url": "https://github.com/leetcode-pp/91alg-4/issues/1#issuecomment-833191484",
10-
"body": "2121"
10+
"body": ""
1111
},
1212
null,
1313
{
1414
"title": "768. 最多能完成排序的块 II",
1515
"url": "https://github.com/leetcode-pp/91alg-4/issues/1#issuecomment-833191484",
16-
"body": "2121"
16+
"body": ""
1717
},
1818
null,
1919
null,

static/solution/solutions.json

Lines changed: 288 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)