Scrape RNZ #16585
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 RNZ | |
on: | |
schedule: | |
- cron: '*/30 * * * *' # this will run the action every 30 minutes | |
push: | |
jobs: | |
scrape: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests BeautifulSoup4 jinja2 | |
- name: Run script | |
run: python script.py | |
- name: Commit and push if it changed | |
run: | | |
git diff | |
git config --global user.email "action@github.com" | |
git config --global user.name "GitHub Action" | |
git add index.html article_*.html | |
git commit -am "Update headlines" -a || echo "No changes to commit" | |
git push |