Skip to content

aggiorna dati api

aggiorna dati api #203

name: aggiorna dati api
on:
# push:
repository_dispatch:
schedule:
- cron: "25 4 * * *"
# - cron: "3 8-11 * * *"
# - cron: "3 11-23/2 * * *"
workflow_dispatch:
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Utilizza l'action github checkout@v2, per automatizzare il check-out
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: installa flatterer
run: |-
pip install flatterer
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '20'
- name: Prepara gli strumenti
run: |
mkdir -p ~/bin
cp bin/mlrgo ~/bin/
chmod +x ~/bin/mlrgo
echo "$HOME/bin" >> $GITHUB_PATH
- name: Installa Chrome
run: npx puppeteer browsers install chrome
- name: Imposta variabile d'ambiente per il percorso della cache di Puppeteer
run: echo "export PUPPETEER_DOWNLOAD_PATH=/home/runner/.cache/puppeteer" >> $GITHUB_ENV
- name: Installa dipendenze
run: |
npm install puppeteer
npm install fs-extra
npm install path
- name: esegui lo script base
run: |-
export PATH=$PATH:~/bin
cd ./script
chmod +x ./rete_ricarica_veicoli_elettrici_api.sh
node rete_ricarica_veicoli_elettrici.js
./rete_ricarica_veicoli_elettrici_api.sh
- name: Pulisci cartelle temporanee
run: rm -rf node_modules
- name: Committa e pusha se ci sono variazioni nei dati
run: |-
git config user.name "automatico"
git config user.email "actions@users.noreply.github.com"
git add -A
timestamp=$(date --iso-8601=seconds)
git commit -m "aggiornamento dati api: ${timestamp}" || exit 0
git push