This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
read time sync #824
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: read time 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 }} | |
WEREAD_COOKIE: ${{ secrets.WEREAD_COOKIE }} | |
BOOK_DATABASE_NAME: ${{ vars.BOOK_DATABASE_NAME }} | |
AUTHOR_DATABASE_NAME: ${{ vars.AUTHOR_DATABASE_NAME }} | |
CATEGORY_DATABASE_NAME: ${{ vars.CATEGORY_DATABASE_NAME }} | |
BOOKMARK_DATABASE_NAME: ${{ vars.BOOKMARK_DATABASE_NAME }} | |
REVIEW_DATABASE_NAME: ${{ vars.REVIEW_DATABASE_NAME }} | |
CHAPTER_DATABASE_NAME: ${{ vars.CHAPTER_DATABASE_NAME }} | |
YEAR_DATABASE_NAME: ${{ vars.YEAR_DATABASE_NAME }} | |
WEEK_DATABASE_NAME: ${{ vars.WEEK_DATABASE_NAME }} | |
MONTH_DATABASE_NAME: ${{ vars.MONTH_DATABASE_NAME }} | |
DAY_DATABASE_NAME: ${{ vars.DAY_DATABASE_NAME }} | |
REF: ${{ github.ref }} | |
REPOSITORY: ${{ github.repository }} | |
YEAR: ${{ vars.YEAR }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- 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: weread heatmap | |
run: | | |
github_heatmap weread --weread_cookie "${{secrets.WEREAD_COOKIE}}" --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: Rename weread.svg to a random name | |
run: | | |
RANDOM_FILENAME=$(uuidgen).svg | |
mv ./OUT_FOLDER/weread.svg ./OUT_FOLDER/$RANDOM_FILENAME | |
echo "Renamed file to $RANDOM_FILENAME" | |
- name: read time sync | |
run: | | |
python -u scripts/read_time.py |