Skip to content

automation

automation #7

Workflow file for this run

name: automation
on:
schedule:
- cron: '0 0 10 * *'
workflow_dispatch:
jobs:
scrape:
runs-on: ubuntu-latest
steps:
- name: Check out this repo
uses: actions/checkout@v3
with:
token: ${{ secrets.MY_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install necessary packages
run: |
sudo apt-get update
sudo apt-get install -y chromium-browser
sudo apt-get install -y wget
pip install requests beautifulsoup4 pandas webdriver-manager selenium
- name: Run the scraping script
run: python scraper.py
- name: Commit downloaded files if any
run: |
cd downloads
git add -A
git commit -m "Add new downloaded files" || echo "No new files to commit"
- name: Stash any uncommitted changes (if any)
run: |
git stash || echo "No changes to stash"
- name: Pull the latest changes
run: |
git pull origin main --rebase
- name: Apply stashed changes (if any)
run: |
git stash pop || echo "No stashed changes"
- name: Commit and push changes
run: |
git config --local user.name "github-actions"
git config --local user.email "actions@users.noreply.github.com"
git diff --exit-code || echo "Changes detected"
git add -A
git commit -m "Auto-commit from GitHub Actions at $(date -u)" || echo "No changes to commit"
git pull --rebase || echo "Nothing to rebase"
git push || echo "Nothing to push"
env:
GITHUB_TOKEN: ${{ secrets.MY_TOKEN }}