-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (50 loc) · 1.84 KB
/
scrape-bn-auto.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This is a basic workflow to help you get started with Actions
name: scrape-bn-auto
# Controls when the workflow will run
on:
schedule:
- cron: 09 01 * * * # runs at 00:08 UTC (08:08 BNT) for Breakfast Menu
- cron: 44 06 * * * # runs at 06:44 UTC (14:44 BNT) for Regular Menu
workflow_dispatch:
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 "scrape"
scrape:
# 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@v4
# with:
# python-version: 3.8.2
- name: setup dependencies
working-directory: ./mcd-scr-bn
run: |
pip3 install scrapy==2.6.1
pip3 install pandas
pip3 install pytz
pip3 install path
pip3 install pathlib2
pip3 install pyopenssl
# pip3 install pyopenssl==22.0.0
- name: execute py script # run mcd-scr-bn.py to get the latest data
working-directory: ./mcd-scr-bn
run: |
scrapy crawl mcd-scr-bn
- 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)
if ! git diff-index --quiet HEAD; then
git commit -m "Scraped: [${timestamp}] mcd-scr-bn (auto)"
git push "https://${GITHUB_ACTOR}:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD || exit 0
fi
#EOF