Get Services Status #1981
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
get-services-status: | |
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 | |
- 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 | |
- 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 |