scrape-ph-auto #5058
This file contains hidden or 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-ph-auto | |
| # Controls when the workflow will run | |
| on: | |
| schedule: | |
| - cron: 46 20 * * * # runs at 02:46 UTC (10:46 PHT) for Regular Menu | |
| - cron: 26 16 * * * # runs at 22:26 UTC (06:26 PHT) for Breakfast Menu | |
| 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@v3 # checkout the repository content to github runner. | |
| - name: setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: setup dependencies | |
| working-directory: ./mcd-scr-ph | |
| run: | | |
| pip3 install scrapy==2.11.2 | |
| pip3 install pandas | |
| pip3 install pytz | |
| pip3 install path | |
| pip3 install pathlib2 | |
| pip3 install pyopenssl==22.0.0 | |
| pip3 install cryptography==37.0.4 --ignore-installed | |
| - name: execute py script # run mcd-scr-ph.py to get the latest data | |
| working-directory: ./mcd-scr-ph | |
| run: | | |
| scrapy crawl mcd-scr-ph | |
| - 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-scr-ph (auto)" | |
| git push "https://${GITHUB_ACTOR}:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:main || exit 0 |