Skip to content

python-zhihu

python-zhihu #8532

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: python-zhihu
on:
push:
branches: [ "main" ]
schedule:
- cron: "*/15 * * * *" # See https://crontab.guru/#*/15_*_*_*_*
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
permissions: # Job-level permissions configuration starts here
contents: write # 'write' access to repository contents
pull-requests: write # 'write' access to pull requests
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests beautifulsoup4
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Generate Zhihu hot json file
run: |
cd actions && python get-latest-zhihu-hot-questions.py
- name: Git Commit
run: |
DATE=$(date +"%Y-%m-%d %H:%M")
MSG="Update Zhihu Hot at "
git config --local user.email "3280204+ycrao@users.noreply.github.com"
git config --local user.name "GitHub Action"
git add outputs/
git commit -m "$MSG $DATE (UTC)"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}