透過 GitHub Actions 自動抓取自己寫的 CodeLove 文章,並更新專案根目錄的 README.md

使用方法

  1. 創建檔案 .github/workflows/codelove-updater.yml 在專案中:
name: Test Codelove Blog Updater

# You can modify the workflow to run on different events
on:
  workflow_run:
    workflows: ['Build Action']
    types:
      - completed
    branches: [main]
  workflow_dispatch:

permissions:
  contents: write

jobs:
  test-action:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Test Codelove Blog Updater
        uses: jaosn60810/readme-codelove-list@main
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          # 換成自己的 USERNAME
          CODELOVE_USERNAME: 'XXX'

      - name: Commit changes
        uses: EndBug/add-and-commit@v9
        with:
          message: 'test: update README with latest blog posts'
          add: 'README.md'
  1. 把標籤加到要顯示的地方:
## Latest Blog Posts

<!-- UPDATE_CODELOVE:START -->
文章會列在這裡
<!-- UPDATE_CODELOVE:END -->
按讚的人:

共有 1 則留言


此人尚未填寫簡介。
🏆 本月排行榜
🥇
站長阿川
📝11   💬8   ❤️16
513
🥈
我愛JS
📝1   💬5   ❤️4
85
🥉
酷豪
📝1   ❤️1
48
#4
AppleLily
📝1   💬4   ❤️1
36
#5
💬3  
10
評分標準:發文×10 + 留言×3 + 獲讚×5 + 點讚×1 + 瀏覽數÷10
本數據每小時更新一次