Send notifications for new/resolved outages #636
This file contains hidden or 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: Send notifications for new/resolved outages | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '*/6 * * * *' | |
env: | |
PWRONDATABOT_TOKEN: ${{ secrets.PWRONDATABOT_TOKEN }} | |
GEOCODE_API_KEY: ${{ secrets.GEOCODE_API_KEY }} | |
jobs: | |
outage_watcher: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: outage-data-analysis | |
steps: | |
- name: Checkout current repository | |
uses: actions/checkout@v4 | |
with: | |
path: outage-data-analysis | |
- name: Checkout the pse repository | |
uses: actions/checkout@v4 | |
with: | |
repository: davemattson/pse-outage | |
path: pse-outage | |
fetch-depth: 20 | |
- name: Checkout the scl repository | |
uses: actions/checkout@v4 | |
with: | |
repository: davemattson/scl-outage | |
path: scl-outage | |
fetch-depth: 20 | |
- name: Checkout the snopud repository | |
uses: actions/checkout@v4 | |
with: | |
repository: davemattson/snopud-outage | |
path: snopud-outage | |
fetch-depth: 20 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' # Use the latest Python 3 version | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pykml | |
pip install pandas | |
pip install pytz | |
pip install requests | |
pip install gitpython | |
- uses: qoomon/actions--setup-git@v1 | |
with: | |
user: bot | |
- name: Run pse expand | |
continue-on-error: true | |
run: | | |
git pull origin main | |
python -u expand.py -r ../pse-outage -i last_file_pse.txt -o output_files -l 2 ../pse-outage/pse-events.json | |
- name: Save pse progress if succeeded | |
continue-on-error: true | |
if: success() | |
run: | | |
git add last_file_pse.txt | |
git commit -m "updating file to track latest processed commit for PSE" | |
git push -u origin main | |
- name: Run pse notify | |
continue-on-error: true | |
run: | | |
python -u create_outages_dataframe.py -l -d output_files -u pse -o output_files/pse_outages_dataframe.csv | |
python -u analyze_current_outages.py -f output_files/pse_outages_dataframe.csv -l 4 -c 100 -e .25 -u pse --telegram-token "${PWRONDATABOT_TOKEN}" --telegram-chat-id "-1002452542176" --telegram-thread-id "4789" --geocode-api-key "${GEOCODE_API_KEY}" | |
- name: Run scl expand | |
continue-on-error: true | |
run: | | |
git pull origin main | |
python -u expand.py -r ../scl-outage -i last_file_scl.txt -o output_files -l 2 ../scl-outage/scl-events.json | |
- name: Save scl progress if succeeded | |
continue-on-error: true | |
if: success() | |
run: | | |
git add last_file_scl.txt | |
git commit -m "updating file to track latest processed commit for SCL" | |
git push -u origin main | |
- name: Run scl notifier | |
continue-on-error: true | |
run: | | |
python -u create_outages_dataframe.py -l -d output_files -u scl -o output_files/scl_outages_dataframe.csv | |
python -u analyze_current_outages.py -f output_files/scl_outages_dataframe.csv -l 4 -c 100 -e .25 -u scl --telegram-token "${PWRONDATABOT_TOKEN}" --telegram-chat-id "-1002452542176" --telegram-thread-id "4789" --geocode-api-key "${GEOCODE_API_KEY}" | |
- name: Run snopud expand | |
continue-on-error: true | |
run: | | |
git pull origin main | |
python -u expand.py -r ../snopud-outage -i last_file_snopud.txt -o output_files -l 2 ../snopud-outage/KMLOutageAreas.xml | |
- name: Save snopud progress if succeeded | |
continue-on-error: true | |
if: success() | |
run: | | |
git add last_file_snopud.txt | |
git commit -m "updating file to track latest processed commit for snopud" | |
git push -u origin main | |
- name: Run snopud notifier | |
continue-on-error: true | |
run: | | |
python -u create_outages_dataframe.py -l -d output_files -u snopud -o output_files/snopud_outages_dataframe.csv | |
python -u analyze_current_outages.py -f output_files/snopud_outages_dataframe.csv -l 4 -c 100 -e .25 -u snopud --telegram-token "${PWRONDATABOT_TOKEN}" --telegram-chat-id "-1002452542176" --telegram-thread-id "4789" --geocode-api-key "${GEOCODE_API_KEY}" | |