Visitor Count #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |