scrape-pk-auto #1109
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
# This is a basic workflow to help you get started with Actions | |
name: scrape-pk-auto | |
# Controls when the workflow will run | |
on: | |
schedule: | |
- cron: 11 21 * * * # runs once a day at 21:11 UTC (02:11 PKT) | |
concurrency: | |
group: scrape-and-schedule | |
cancel-in-progress: false | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v2 # checkout the repository content to github runner. | |
- name: setup python | |
uses: actions/setup-python@v2 | |
# with: | |
# python-version: 3.8.2 | |
- name: setup dependencies | |
working-directory: ./mcd-bs4-pk | |
run: | | |
pip install beautifulsoup4 | |
pip install pandas | |
pip install lxml | |
pip install pytz | |
pip3 install requests | |
pip install path | |
pip install pathlib2 | |
- name: execute py script # run mcd-bs4-pk.py to get the latest data | |
working-directory: ./mcd-bs4-pk | |
run: | | |
python mcd-bs4-pk.py | |
- name: Commit and push if it changed | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Scraped: [${timestamp}] mcd-bs4-pk (auto)" | |
git push "https://${GITHUB_ACTOR}:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:main || exit 0 |