Actions执行后同步数据 #455
This file contains hidden or 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: "Actions执行后同步数据" | |
| on: | |
| workflow_run: | |
| workflows: | |
| - "🧩手动更新任意收录插件" | |
| - "定时更新GitHub源插件" | |
| - "推送检测改动表格条目" | |
| branches: | |
| - "master" | |
| types: | |
| - completed | |
| jobs: | |
| download-sync: | |
| name: "下载API并推送Gitee" | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: "ZIP_CDN数据" | |
| run: | | |
| curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s https://api.github.com/repos/typecho-fans/plugins/contents/ZIP_CDN > ZIP_CDN.json | |
| - name: "文档变更时间" | |
| run: | | |
| get_commit_date() { | |
| curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/typecho-fans/plugins/commits?path=$1&page=1&per_page=1" | jq -r ".[0].commit.committer.date" | |
| } | |
| date_testore=$(get_commit_date "TESTORE.md") | |
| date_readme=$(get_commit_date "README.md") | |
| if [[ $date_testore > $date_readme ]]; then | |
| echo $date_testore > UD_TIME.json | |
| else | |
| echo $date_readme > UD_TIME.json | |
| fi | |
| - name: "提交文件更新" | |
| uses: stefanzweifel/git-auto-commit-action@v6 | |
| with: | |
| commit_message: "Fetch API data & sync repo to Gitee for TeStore accelerations" | |
| - name: "同步Gitee镜像" | |
| uses: Yikun/hub-mirror-action@master | |
| with: | |
| src: github/typecho-fans | |
| dst: gitee/typecho-fans | |
| dst_key: ${{ secrets.SYNC_PV }} | |
| dst_token: ${{ secrets.GITEE_TOKEN }} | |
| account_type: org | |
| static_list: "plugins" | |
| force_update: true |