generate weread card #464
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: generate weread card | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0/8 * * *" | |
jobs: | |
card: | |
name: Card | |
runs-on: ubuntu-latest | |
env: | |
WEREAD_COOKIE: ${{ secrets.WEREAD_COOKIE }} | |
BOOK_COUNT: ${{ secrets.BOOK_COUNT }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Set default BOOK_COUNT if not set | |
run: | | |
if [ -z "$BOOK_COUNT" ]; then | |
echo "BOOK_COUNT=4" >> $GITHUB_ENV | |
fi | |
- name: generate weread card | |
run: | | |
python main.py -n $BOOK_COUNT -c "$WEREAD_COOKIE" | |
- name: push | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m 'generate weread card' || echo "nothing to commit" | |
git push || echo "nothing to push" |