Automate and Create Pull Request #17
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: Automate and Create Pull Request | |
on: | |
schedule: | |
# Run every day at 3 PM Beijing time (UTC+8) | |
- cron: '0 7 * * 1-5' | |
workflow_dispatch: | |
jobs: | |
automate-and-pr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install llm | |
pip install requests | |
- name: Run automation script | |
env: | |
SCHOLAR_INBOX_URL: ${{ secrets.SCHOLAR_INBOX_URL }} | |
SCHOLAR_INBOX_COOKIES: ${{ secrets.SCHOLAR_INBOX_COOKIES }} | |
GPT_API_BASE: ${{ secrets.GPT_API_BASE }} | |
GPT_KEY: ${{ secrets.GPT_KEY }} | |
run: | | |
python automate.py | |
- name: Get current date | |
id: get-date | |
run: echo "current_date=$(date '+%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.TOKEN }} | |
commit-message: 'Automated update on ${{ env.current_date }}' | |
branch: 'automated-update' | |
branch-suffix: 'timestamp' | |
delete-branch: true | |
title: '[Update] Automated update on ${{ env.current_date }}' | |
body-path: 'debug.log' | |
draft: true |