Generate Daily Markdown #247
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 Daily Markdown | |
on: | |
schedule: | |
- cron: '01 7 * * *' # 每天UTC时间早上7:01(北京时间下午3:01自动运行) | |
workflow_dispatch: # 手动触发 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install openai>=1.0.0 | |
pip install python-wordpress-xmlrpc | |
- name: Generate Markdown | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
PRODUCTHUNT_CLIENT_ID: ${{ secrets.PRODUCTHUNT_CLIENT_ID }} | |
PRODUCTHUNT_CLIENT_SECRET: ${{ secrets.PRODUCTHUNT_CLIENT_SECRET }} | |
run: | | |
python scripts/product_hunt_list_to_md.py | |
- name: Commit files | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Generated daily content" | |
- name: Push changes | |
run: | | |
git push --force https://${{ secrets.PAT }}@github.com/${{ github.repository_owner }}/producthunt-daily-hot.git HEAD:main |