-
Notifications
You must be signed in to change notification settings - Fork 578
55 lines (53 loc) · 2.17 KB
/
douban_movie.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: douban movie sync
on:
workflow_dispatch:
schedule:
- cron: "0 16 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync:
name: Sync
runs-on: ubuntu-latest
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
MOVIE_NOTION_TOKEN: ${{ secrets.MOVIE_NOTION_TOKEN }}
NOTION_MOVIE_URL: ${{ secrets.NOTION_MOVIE_URL }}
DOUBAN_NAME: ${{ secrets.DOUBAN_NAME }}
YEAR: ${{ vars.YEAR }}
REF: ${{ github.ref }}
REPOSITORY: ${{ github.repository }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: douban movie sync
run: |
python -u scripts/douban.py "movie"
- name: Remove folder
run: rm -rf ./OUT_FOLDER/movie
- name: Set default year if not provided
run: echo "YEAR=$(date +"%Y")" >> $GITHUB_ENV
if: env.YEAR == ''
- name: notion heatmap
run: |
github_heatmap notion --notion_token "${{secrets.MOVIE_NOTION_TOKEN || secrets.NOTION_TOKEN}}" --database_id "${{ env.DATABASE_ID }}" --date_prop_name "日期" --value_prop_name "看过" --unit "部" --year $YEAR --me "${{secrets.MOVIE_NAME}}" --without-type-name --background-color=${{ vars.background_color||'#FFFFFF'}} --track-color=${{ vars.track_color||'#ACE7AE'}} --special-color1=${{ vars.special_color||'#69C16E'}} --special-color2=${{ vars.special_color2||'#549F57'}} --dom-color=${{ vars.dom_color||'#EBEDF0'}} --text-color=${{ vars.text_color||'#000000'}}
- name: udpate heatmap
run: |
python -u scripts/update_heatmap.py "movie"
- name: push
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m 'add new heatmap' || echo "nothing to commit"
git pull --rebase origin main
git push || echo "nothing to push"