Skip to content

Commit 1f243c4

Browse files
committed
update readme
1 parent 2a52a20 commit 1f243c4

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

.github/scripts/update_leetcode.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import fs from "fs";
2-
import fetch from "node-fetch";
1+
const fs = require("fs");
2+
const fetch = require("node-fetch");
33

4-
const username = "hogantech";
4+
const username = "hogantech";
55
const url = `https://leetcard.jacoblin.cool/${username}?ext=heatmap`;
6-
76
const outputPath = "./assets/leetcode.svg";
87

98
async function updateLeetCodeCard() {
@@ -12,9 +11,10 @@ async function updateLeetCodeCard() {
1211
if (!response.ok) throw new Error(`HTTP ${response.status}`);
1312
const svg = await response.text();
1413
fs.writeFileSync(outputPath, svg);
15-
console.log("LeetCode stats card updated successfully!");
14+
console.log("LeetCode stats card updated successfully!");
1615
} catch (err) {
17-
console.error("Failed to update LeetCode stats:", err);
16+
console.error("❌ Failed to update LeetCode stats:", err);
17+
process.exit(1);
1818
}
1919
}
2020

.github/workflows/python-publish.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,32 @@ on:
77
- cron: "0 */2 * * *"
88

99
jobs:
10-
# ---------- LeetCode job ----------
1110
update-leetcode:
1211
name: Update local LeetCode stats card
1312
runs-on: ubuntu-latest
13+
1414
steps:
1515
- name: Checkout repository
1616
uses: actions/checkout@v4
17+
with:
18+
persist-credentials: true
1719

1820
- name: Setup Node.js
1921
uses: actions/setup-node@v4
2022
with:
2123
node-version: 20
2224

2325
- name: Install dependencies
24-
run: npm install node-fetch@3
26+
run: npm install node-fetch@2
2527

2628
- name: Generate latest LeetCode SVG
2729
run: |
2830
mkdir -p assets
2931
node .github/scripts/update_leetcode.js
3032
3133
- name: Commit and push updated LeetCode card
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3236
run: |
3337
git config user.name "github-actions[bot]"
3438
git config user.email "github-actions[bot]@users.noreply.github.com"

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "leetcode-solution",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"dependencies": {
6+
"node-fetch": "^3.3.2"
7+
}
8+
}

0 commit comments

Comments
 (0)