Disponibilità medici di base #120
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: Disponibilità medici di base | |
on: | |
schedule: | |
- cron: '55 07 * * 1-5' # Esegue ogni giorno alle 7:55 UTC --> 8:55 dal lunedì al venerdì | |
- cron: '00 09 * * 6,0' # Esegue ogni giorno alle 9:00 UTC --> 10:00 dal sabato a domenica | |
workflow_dispatch: | |
jobs: | |
check_availability: | |
runs-on: ubuntu-latest | |
env: | |
DOCTORS_LIST: ${{ secrets.MEDICOLIST }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests beautifulsoup4 regex | |
- name: Run availability check | |
id: availability_check | |
run: | | |
# Esegui lo script Python e salva l'output nella variabile output_message | |
output_message=$(python scrape_doctor.py) | |
# Nascondi ogni riga dell'output nei log per la privacy | |
while IFS= read -r line; do | |
echo "::add-mask::$line" | |
done <<< "$output_message" | |
# Aggiungi l'output completo come variabile di ambiente per il passaggio successivo | |
echo "output_message<<EOF" >> $GITHUB_ENV | |
echo "$output_message" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Send availability message | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_CHAT_ID }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: ${{ env.output_message }} |