This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
forked from kubowania/burger-api
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 1.99 KB
/
fetcher.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: 'Fetch latest data'
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *' # At 00:00 on day-of-month 1 (~8AM MYT)
jobs:
update:
runs-on: ubuntu-latest
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.10' # install the python version needed
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install requests
pip install tzdata
- name: execute py script # run fetcher.py to get the latest data
run: python fetcher.py
- name: commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m ":card_file_box: update db `date +"%m-%Y"`" -a
- uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: 'mpt-backup-api' #Must be unique in Heroku
heroku_email: 'iqmal3@outlook.com'
- name: push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: telegram notify
uses: fjogeleit/http-request-action@v1.8.1
with:
url: 'https://api.telegram.org/bot${{secrets.TELE_BOT_API_KEY}}/sendMessage'
method: 'POST'
data: '{
"chat_id": -1001220707105,
"parse_mode": "MarkdownV2",
"disable_web_page_preview": true,
"text": "${{github.workflow}} *completed* \uD83C\uDF89 Latest data updated\\. Triggered by `${{github.event_name}}`\\. View [website](https:\/\/mpt-backup-api.herokuapp.com) or [action runs](https:\/\/github.com\/${{github.repository}}\/actions\/runs\/${{github.run_id}})\\."
}'