toggl sync #2
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: toggl sync | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
sync: | |
name: Sync | |
runs-on: ubuntu-latest | |
env: | |
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} | |
NOTION_MOVIE_URL: ${{ secrets.NOTION_URL }} | |
NOTION_BOOK_URL: ${{ secrets.NOTION_BOOK_URL }} | |
EMAIL: ${{ secrets.EMAIL }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
YEAR: ${{ vars.YEAR }} | |
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: toggl sync | |
run: | | |
python -u scripts/toggl.py "book" | |
- 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: notion 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.BOOK_NAME}}" --without-type-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: Rename notion.svg to a random name | |
run: | | |
RANDOM_FILENAME=$(uuidgen).svg | |
mv ./OUT_FOLDER/notion.svg ./OUT_FOLDER/$RANDOM_FILENAME | |
echo "Renamed file to $RANDOM_FILENAME" | |
- name: udpate heatmap | |
run: | | |
python -u scripts/update_heatmap.py "book" |