Sync Douban Data #1103
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: Sync Douban Data | |
on: | |
schedule: | |
- cron: "0 */12 * * *" | |
# watch: | |
# types: [started] | |
workflow_dispatch: | |
repository_dispatch: | |
types: [sync-douban] | |
jobs: | |
douban: | |
name: Douban Data Sync | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: WORK_DIR | |
run: | | |
# 把当前目录保存到环境变量中 | |
echo "WORK_DIR=$(pwd)" >> $GITHUB_ENV | |
- name: OLD_SHA256 | |
run: | | |
OLD_SHA256=$(sha256sum ${{ env.WORK_DIR }}/data/neodb/movie.json | cut -d ' ' -f 1) | |
echo "OLD_SHA256=$(CURRENT_SHA256)" >> $GITHUB_ENV | |
- name: Fetch Movie Data JSON | |
uses: lizheming/doumark-action@master | |
with: | |
id: eallion | |
type: movie | |
format: json | |
dir: ./data/douban | |
- name: Sync to NeoDB | |
uses: lizheming/doumark-action@master | |
with: | |
id: eallion | |
type: movie | |
format: neodb | |
neodb_token: ${{ secrets.NEODB_ACCESS_TOKEN }} | |
# - name: Sync Movie to Notion | |
# uses: lizheming/doumark-action@master | |
# with: | |
# id: eallion | |
# type: movie | |
# format: notion | |
# dir: ${{ secrets.NOTION_MOVIE_ID }} | |
# notion_token: ${{ secrets.NOTION_ACCESS_TOKEN }} | |
- name: Fetch Book Data JSON | |
uses: lizheming/doumark-action@master | |
with: | |
id: eallion | |
type: book | |
format: json | |
dir: ./data/douban | |
- name: Sync Book to NeoDB | |
uses: lizheming/doumark-action@master | |
with: | |
id: eallion | |
type: book | |
format: neodb | |
neodb_token: ${{ secrets.NEODB_ACCESS_TOKEN }} | |
# - name: Sync Book to Notion | |
# uses: lizheming/doumark-action@master | |
# with: | |
# id: eallion | |
# type: movie | |
# format: notion | |
# dir: ${{ secrets.NOTION_BOOK_ID }} | |
# notion_token: ${{ secrets.NOTION_ACCESS_TOKEN }} | |
- name: Git Commit | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: 'chore(data): update douban data' | |
add: './data/douban' | |
- name: CURRENT_SHA256 | |
run: | | |
CURRENT_SHA256=$(sha256sum ${{ env.WORK_DIR }}/data/neodb/movie.json | cut -d ' ' -f 1) | |
echo "CURRENT_SHA256=$(CURRENT_SHA256)" >> $GITHUB_ENV | |
# 调用另外的 GitHub Actions | |
- name: Sync NeoDB Data | |
if: ${{ env.OLD_SHA256 != env.CURRENT_SHA256 }} | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
event-type: sync-neodb |