Skip to content

Meteo RP

Meteo RP #143

Workflow file for this run

name: Meteo RP
on:
schedule:
- cron: '0 17 */3 * *' # Runs every day at 17:00
workflow_dispatch:
jobs:
send_advice:
runs-on: ubuntu-latest
steps:
- name: Send meteo
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
# Download JSON data
states_json_url="https://gist.githubusercontent.com/symsym-1629/06293c4c49864927e51db27eb8c354fe/raw/7879e3ce36758645315063c3d9f443fa7aab15fd/states.json"
states_json=$(curl -s "$states_json_url")
# Extract advice strings
states_list=$(echo "$states_json" | jq -c -r '.states[]')
# Get a random advice
random_state=$(echo "$states_list" | shuf -n 1)
# Send advice to Discord webhook
content="$random_state"
payload="{\"content\": \"$content\"}"
curl -s -X POST -H "Content-Type: application/json" -d "$payload" $DISCORD_WEBHOOK_URL