Skip to content

todo sync

todo sync #794

Workflow file for this run

name: todo sync
on:
workflow_dispatch:
schedule:
- cron: "0 */3 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync:
name: Sync
runs-on: ubuntu-latest
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
NOTION_PAGE: ${{ secrets.NOTION_PAGE }}
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: todo sync
run: |
todo
- name: Remove folder
run: rm -rf ./OUT_FOLDER
- name: Set default year if not provided
run: echo "YEAR=$(date +"%Y")" >> $GITHUB_ENV
# if: env.YEAR == ''
- name: todo heatmap
run: |
github_heatmap notion --notion_token "${{secrets.NOTION_TOKEN}}" --database_id "${{ env.DATABASE_ID }}" --date_prop_name "日期" --value_prop_name "完成任务数" --unit "个" --year $YEAR --me "${{secrets.TODO_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: Rename notion.svg to a random name
run: |
RANDOM_FILENAME=$(uuidgen).svg
HEATMAP_FOLDER="./heatmap/todo"
rm -rf $HEATMAP_FOLDER
mkdir -p "$HEATMAP_FOLDER"
mv ./OUT_FOLDER/notion.svg $HEATMAP_FOLDER/$RANDOM_FILENAME
echo "Renamed file to $RANDOM_FILENAME"
- 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 heatmap' || echo "nothing to commit"
git push || echo "nothing to push"
- name: udpate heatmap
run: |
update_heatmap