Fetch JSON Data #1451
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: Fetch JSON Data | ||
on: | ||
schedule: | ||
- cron: '*/5 * * * *' # 每天 UTC 时间 04:00 执行 | ||
workflow_dispatch: | ||
jobs: | ||
fetch-json: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref:'jiang' | ||
- name: Fetch JSON data | ||
run: | | ||
curl https://api.dabing.one > src/resources/data.json | ||
- name: Save JSON data to repository | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "GitHub Actions" | ||
git checkout -b jiang | ||
git pull | ||
git add src/resources/data.json | ||
git commit -m "Update data.json" | ||
git push origin jiang | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} |