Skip to content

Commit dc3b043

Browse files
authored
Update updateLeaderboard.js
1 parent aa5f28a commit dc3b043

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/updateLeaderboard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = async ({ github, context }) => {
4545
console.log(`Score: ${score}`);
4646

4747
// Tạo dòng mới để thêm vào bảng
48-
const newEntry = `| ${score} | [<img src="${issue.author.avatarUrl}" alt="${issue.author.login}" width="24" /> ${name}](${githubLink}) | ${message} | ${new Date(issue.updatedAt).toLocaleString('en-US', { timeZone: 'Asia/Ho_Chi_Minh' })} |`;
48+
const newEntry = `| ${score} | [<img src="${issue.author.avatarUrl}" alt="${issue.author.login}" width="24" /> ${name}](${githubLink}) | ${message} | ${new Date(issue.updatedAt).toLocaleString('en-US', { timeZone: 'Asia/Ho_Chi_Minh' })} |\n`;
4949

5050
const fileSystem = require('fs');
5151
const readmePath = 'README.md';
@@ -55,8 +55,8 @@ module.exports = async ({ github, context }) => {
5555
const leaderboardSection = /<!-- Leaderboard -->[\s\S]*?<!-- \/Leaderboard -->/.exec(readme);
5656

5757
if (leaderboardSection) {
58-
// Tìm vị trí của tiêu đề trong bảng
59-
const headerMatch = /(\| Score \|[\s\S]*?\| Date \|)/.exec(leaderboardSection[0]);
58+
// Tìm vị trí của tiêu đề và dòng phân cách trong bảng
59+
const headerMatch = /(\| Score \| Player \| Message \| Date \|\n\|-------\|--------\|---------\|------\|)/.exec(leaderboardSection[0]);
6060

6161
if (headerMatch) {
6262
// Chèn newEntry ngay dưới tiêu đề

0 commit comments

Comments
 (0)