Skip to content

Update State File #2675

Update State File

Update State File #2675

name: Update State File
on:
schedule:
- cron: "*/30 * * * *" # Runs every 30 minutes
workflow_dispatch: # Allows manual trigger
jobs:
update-state:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run State Aggregation & Notification Script
env:
SENDER_EMAIL_ADDRESS: ${{ secrets.SENDER_EMAIL_ADDRESS }}
SENDER_EMAIL_PASSWORD: ${{ secrets.SENDER_EMAIL_PASSWORD }}
RECIPIENT_EMAIL_ADDRESS: ${{ secrets.RECIPIENT_EMAIL_ADDRESS }}
ALERT_INTERVAL_SECONDS: ${{ vars.ALERT_INTERVAL_SECONDS }}
run: |
python src/server/combine_states.py
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add data/state.txt
git add data/heartbeat.txt
git commit -m "Update state.txt & heartbeat.txt with logical combination of device specific files" || echo "No changes to commit"
git push