Data Scraper #924
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: Data Scraper | |
on: | |
schedule: | |
- cron: '0 8 * * *' | |
- cron: '0 12 * * *' | |
- cron: '0 16 * * *' | |
- cron: '0 20 * * *' | |
permissions: | |
contents: write | |
issues: read | |
jobs: | |
fetch-and-append-temperature: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
# This token is required to push changes back to the repository | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- 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 requests beautifulsoup4 | |
- name: Run the script | |
run: python src/scraper.py | |
- name: Commit and push if there are changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add * | |
git commit -m "Update data" || echo "No changes to commit" | |
git push |