www.git

www

~ Personal site — projects, posts, about. Built with sqzass.
git clone https://github.com/debuman/www.git

.github/workflows/stars.yml (1178B)

      1 name: Refresh stars
      2 
      3 # 별 개수는 front matter 에 구워 둔다 — 렌더 중에 네트워크를 부르면 재현되는
      4 # 빌드가 아니게 되고, 브라우저에서 부르면 익명 API 한도(IP 당 60/시간)에
      5 # 걸린다. 대신 하루 한 번 여기서 갱신하고, 바뀐 게 있을 때만 커밋한다.
      6 # 커밋이 나가면 pages.yml 이 이어서 돌아 배포한다.
      7 
      8 on:
      9   schedule:
     10     - cron: "17 4 * * *"
     11   workflow_dispatch:
     12 
     13 permissions:
     14   contents: write
     15 
     16 concurrency:
     17   group: stars
     18   cancel-in-progress: true
     19 
     20 jobs:
     21   refresh:
     22     runs-on: ubuntu-latest
     23     steps:
     24       - uses: actions/checkout@v7
     25 
     26       - name: Fetch counts
     27         env:
     28           # gh 가 인증되면 한도가 5000/시간이라 프로젝트가 늘어도 안 걸린다.
     29           GH_TOKEN: ${{ github.token }}
     30         run: python3 tools/stars.py
     31 
     32       - name: Commit if changed
     33         run: |
     34           if git diff --quiet; then
     35             echo "변동 없음"
     36             exit 0
     37           fi
     38           git config user.name "sqzer"
     39           git config user.email "110329244+sqzer-x@users.noreply.github.com"
     40           git commit -am "Refresh star counts"
     41           git push