-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (57 loc) · 1.89 KB
/
run.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
57
name: scrape
on:
workflow_dispatch:
schedule:
- cron: "15 2 * * *"
jobs:
scrape:
runs-on: ubuntu-latest
steps:
- name: Check out this repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Installed package list
run: apt list --installed
- name: Remove Chrome
run: sudo apt purge google-chrome-stable
- name: Remove default Chromium
run: sudo apt purge chromium-browser
- name: Install a new Chromium
run: sudo apt install -y chromium-browser
- name: Install all necessary packages
run: pip install requests beautifulsoup4 pandas selenium titlecase googlemaps webdriver-manager
- name: Run the scraping script
env:
LOCATIONS_FILEPATH: ${{ secrets.LOCATIONS_FILEPATH }}
GMAPS_CACHE_FILEPATH: ${{ secrets.GMAPS_CACHE_FILEPATH }}
GMAPS_API_KEY: ${{ secrets.GMAPS_API_KEY }}
run: python backend/main.py
- name: Set up git config
run: |-
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git fetch
- name: Commit changes
run: |-
git add .
timestamp=$(date -u)
git commit -m "Latest data: ${timestamp}"
- name: Push to main
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Checkout to pages branch
run: |-
git checkout pages
git checkout main -- locations.json index.html
git add .
git commit -m "sync"
- name: Push to pages
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: pages