|
| 1 | +name: Send notifications for outages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | + schedule: |
| 7 | + - cron: '*/6 * * * *' |
| 8 | + |
| 9 | +env: |
| 10 | + PWRONDATABOT_TOKEN: ${{ secrets.PWRONDATABOT_TOKEN }} |
| 11 | + GEOCODE_API_KEY: ${{ secrets.GEOCODE_API_KEY }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + outage_watcher: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + defaults: |
| 17 | + run: |
| 18 | + shell: bash |
| 19 | + working-directory: outage-data-analysis |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout current repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + path: outage-data-analysis |
| 26 | + |
| 27 | + - name: Checkout the pse repository |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + repository: davemattson/pse-outage |
| 31 | + path: pse-outage |
| 32 | + fetch-depth: 20 |
| 33 | + |
| 34 | + - name: Checkout the scl repository |
| 35 | + uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + repository: davemattson/scl-outage |
| 38 | + path: scl-outage |
| 39 | + fetch-depth: 20 |
| 40 | + |
| 41 | + - name: Checkout the snopud repository |
| 42 | + uses: actions/checkout@v4 |
| 43 | + with: |
| 44 | + repository: davemattson/snopud-outage |
| 45 | + path: snopud-outage |
| 46 | + fetch-depth: 20 |
| 47 | + |
| 48 | + - name: Set up Python |
| 49 | + uses: actions/setup-python@v5 |
| 50 | + with: |
| 51 | + python-version: '3.x' # Use the latest Python 3 version |
| 52 | + |
| 53 | + - name: Install dependencies |
| 54 | + run: | |
| 55 | + python -m pip install --upgrade pip |
| 56 | + pip install pykml |
| 57 | + pip install pandas |
| 58 | + pip install pytz |
| 59 | + pip install requests |
| 60 | + pip install gitpython |
| 61 | +
|
| 62 | + - uses: qoomon/actions--setup-git@v1 |
| 63 | + with: |
| 64 | + user: bot |
| 65 | + |
| 66 | + - name: Run pse expand |
| 67 | + continue-on-error: true |
| 68 | + run: | |
| 69 | + git pull origin main |
| 70 | + python -u expand.py -r ../pse-outage -i last_file_pse_test.txt -o output_files -l 10 ../pse-outage/pse-events.json |
| 71 | +
|
| 72 | + - name: Save pse progress if succeeded |
| 73 | + continue-on-error: true |
| 74 | + if: success() |
| 75 | + run: | |
| 76 | + git add last_file_pse_test.txt |
| 77 | + git commit -m "updating file to track latest processed commit for PSE" |
| 78 | + git push -u origin main |
| 79 | +
|
| 80 | + - name: Run pse notify |
| 81 | + continue-on-error: true |
| 82 | + run: | |
| 83 | + python -d output_files -r .5 -c 1 -e .1 -u pse --telegram-token "${PWRONDATABOT_TOKEN}" --telegram-chat-id "-1003012377346" --telegram-thread-id "2" --geocode-api-key "${GEOCODE_API_KEY}" |
0 commit comments