Scraping new Electionline pages #57
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: Scrape new ELW pages | |
run-name: Scraping new Electionline pages | |
on: | |
schedule: | |
- cron: '0 10 * * 5' # at 6am ET on Fridays | |
workflow_dispatch: | |
jobs: | |
Scrape-ELW: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup Python environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11.7' | |
- name: Install required packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r elw_scraper/requirements.txt | |
- name: Write secret to file | |
run: | | |
cat << EOF > ./gspread_credentials.json | |
${{ secrets.GSPREAD_SERVICE_ACCOUNT }} | |
EOF | |
- name: Download new pages | |
run: python elw_scraper/add_new_pages.py | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
- name: Commit and push changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Scrape new pages |