diff --git a/.github/workflows/update-traffic-views.yml b/.github/workflows/update-traffic-views.yml index af44481..58f3e50 100644 --- a/.github/workflows/update-traffic-views.yml +++ b/.github/workflows/update-traffic-views.yml @@ -5,7 +5,7 @@ on: - cron: '0 */4 * * *' jobs: - update-badge: + update-traffic-views: runs-on: ubuntu-latest steps: diff --git a/docs/traffic-views.svg b/docs/traffic-views.svg index 92b6421..44b2c98 100644 --- a/docs/traffic-views.svg +++ b/docs/traffic-views.svg @@ -16,5 +16,5 @@ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; } - 过去 14 天内浏览量 1118 次。 + 过去 14 天内浏览量 1195 次。 \ No newline at end of file diff --git a/scripts/update-traffic-views.js b/scripts/update-traffic-views.js index 8a61098..8c6fc5e 100644 --- a/scripts/update-traffic-views.js +++ b/scripts/update-traffic-views.js @@ -8,7 +8,7 @@ import { getTrafficViews } from './common.js' dotenv.config() -async function updateBadge(templatePath, outputPath, newCount) { +async function updateBadgeSvg(templatePath, outputPath, newCount) { const originalBadgeContent = await fs.readFile(outputPath, 'utf8') const templateBadgeContent = await fs.readFile(templatePath, 'utf8') @@ -16,11 +16,11 @@ async function updateBadge(templatePath, outputPath, newCount) { if (currentBadgeContent !== originalBadgeContent) { await fs.writeFile(outputPath, currentBadgeContent, 'utf8') - console.log('badge.svg has been updated.') + console.log('traffic-views.svg has been updated.') return true } - console.log('No changes detected in badge.svg.') + console.log('No changes detected in traffic-views.svg.') return false } @@ -28,10 +28,10 @@ async function updateBadge(templatePath, outputPath, newCount) { ;(async function main() { const totalCount = await getTrafficViews() - const templateBadgePath = path.resolve('docs/templates/badge.svg') - const outputBadgePath = path.resolve('docs/badge.svg') + const templateBadgePath = path.resolve('docs/templates/traffic-views.svg') + const outputBadgePath = path.resolve('docs/traffic-views.svg') - const isUpdated = await updateBadge(templateBadgePath, outputBadgePath, totalCount) + const isUpdated = await updateBadgeSvg(templateBadgePath, outputBadgePath, totalCount) if (!isUpdated) { console.log('No update needed.')