Generate Daily Markdown #6
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: '10 8 * * *' # 每天UTC时间早上8:10(北京时间下午4:10自动运行) | |
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 | |
- 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 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push origin HEAD:main |