weread sync #100
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: weread sync | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
sync: | |
name: Sync | |
runs-on: ubuntu-latest | |
env: | |
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} | |
NOTION_PAGE: ${{ secrets.NOTION_PAGE }} | |
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} | |
WEREAD_COOKIE: ${{ secrets.WEREAD_COOKIE }} | |
CC_URL: ${{ secrets.CC_URL }} | |
CC_ID: ${{ secrets.CC_ID }} | |
CC_PASSWORD: ${{ secrets.CC_PASSWORD }} | |
YEAR: ${{ vars.YEAR }} | |
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: weread sync | |
run: | | |
python scripts/weread.py | |
- name: Set default year if not provided | |
run: echo "YEAR=$(date +"%Y")" >> $GITHUB_ENV | |
if: env.YEAR == '' | |
- name: weread heatmap | |
run: | | |
github_heatmap weread --year $YEAR --me "${{secrets.NAME}}" --with-animation --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: push | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m 'add new cover' || echo "nothing to commit" | |
git push || echo "nothing to push" |