Skip to content

Visitor Count

Visitor Count #7

Workflow file for this run

name: Visitor Count
on:
schedule:
- cron: '0 0 * * *' # 每天 UTC 时间 00:00 运行
workflow_dispatch:
jobs:
update-count:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Update visitor count
run: |
COUNT=$(curl -s https://api.countapi.xyz/hit/Barca0412/Introduction-to-Quantitative-Finance)
echo "COUNT=$COUNT" >> $GITHUB_ENV
- name: Update README
run: |
sed -i "s/Total Visitors: [0-9]*/Total Visitors: $COUNT/" README.md
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add README.md
git commit -m "Update visitor count"
git push