forked from mrtrkmn/deprem
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (75 loc) · 2.8 KB
/
run.yaml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Run deprem bot
on:
schedule:
# every 5 minutes (shortest interval)
# The shortest interval you can run scheduled workflows is once every 5 minutes.
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: "*/5 * * * *"
workflow_dispatch:
inputs:
sehir:
description: "Bildirim almak veya zaman bazlı verileri 'artifact' dosyasına yüklemek için, şehir belirtiniz"
required: false
default: "Kayseri"
zaman_araligi:
description: "
Bildirim almak istediğiniz zaman aralığı, dakika cinsinden veya
zaman bazlı verileri 'artifact' dosyasına yüklemek için
* 3A -> Son 3 Ay
* 3Y-> Son 3 Yıl
* 3G -> Son 3 Gün olarak belirtiniz.
Bu değer G, Y veya A ile biterse zaman bazlı veriler 'artifact' dosyasına yüklenecektir.
"
required: false
default: "5"
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
permissions:
contents: read
jobs:
run_deprem_bot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
cache: "pip" # cache pip dependencies
- name: Get timestamp
id: get-timestamp
run: |
echo "::set-output name=timestamp::$(date +'%Y-%m-%d')"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run deprem bot on demand
if: ${{ github.event_name != 'schedule' }}
run: |
# if TIME_INTERVAL ends with 'A' or 'Y' or 'G', it means that we want to get data for a specific period
if [[ "${{ github.event.inputs.zaman_araligi }}" == *["A","Y","G"] ]]; then
# set env.SAVE_DATA_TO_ARTIFACT to True
SAVE_DATA_TO_ARTIFACT="True" python deprem.py
else
python deprem.py
fi
env:
CITY_TO_BE_CHECKED: "${{ github.event.inputs.sehir }}"
TIME_INTERVAL: ${{ github.event.inputs.zaman_araligi }}
- name: Run deprem bot on schedule
if: ${{ github.event_name == 'schedule' }}
run: |
python deprem.py
env:
CITY_TO_BE_CHECKED: "Kayseri"
TIME_INTERVAL: "5"
- name: Upload data to artifact
if: ${{ github.event.inputs.veriyi_artifact_icerisine_kaydet }} == 'True'
uses: actions/upload-artifact@v3
with:
name: deprem_verisi_${{ github.event.inputs.sehir }}_${{ steps.get-timestamp.outputs.timestamp }}.zip
path: |
*.xlsx
retention-days: 90