-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (55 loc) · 1.75 KB
/
get-services-status.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
58
59
60
61
62
63
64
65
name: Get Services Status
on:
schedule:
- cron: '*/5 * * * *' # See https://crontab.guru/#0_0/2_*_*_* for help
workflow_dispatch: # Permette l'avvio manuale del workflow
jobs:
setup-environment:
runs-on: ubuntu-latest
steps:
- name: Checkout Main Branch
uses: actions/checkout@v4
with:
ref: main
- name: Checkout Data Branch
uses: actions/checkout@v4
with:
ref: data
path: data
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python dependencies
shell: bash
run: python -m pip install -r action-requirements.txt
get-services-status:
runs-on: ubuntu-latest
needs: [setup-environment]
steps:
- name: Get Services Status
id: "get-services-status"
shell: bash
run: |
UPDATE=$(python ../scripts/actions/get-services-status.py
) || exit 1
echo "markdown=$(echo $UPDATE)" >> $GITHUB_OUTPUT
commit-changes:
runs-on: ubuntu-latest
needs: [setup-environment, get-services-status]
steps:
- name: Commit Changes
shell: bash
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Aggiungi i file modificati
git add .
# Verifica se ci sono cambiamenti rispetto al commit precedente
if git diff-index --quiet HEAD --; then
echo "Nessun cambiamento rilevato, niente da aggiornare."
else
git commit -m "Update weather data"
git push origin data
fi
working-directory: data