Skip to content

Commit

Permalink
Send slack message on failure (test)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandru-m-g committed Sep 12, 2024
1 parent 8b3f00a commit d3dcfad
Showing 1 changed file with 26 additions and 32 deletions.
58 changes: 26 additions & 32 deletions .github/workflows/db_export.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,33 @@ jobs:
pip install -r requirements.txt
pip install .
- name: Run Pipeline
env:
BASIC_AUTHS: ${{ secrets.BASIC_AUTHS }}
HDX_KEY: ${{ secrets.HDX_BOT_SCRAPERS_API_TOKEN }}
run: python3.11 -m hapi.pipelines.app -db "postgresql+psycopg://postgres:postgres@localhost:5432/hapi"
# - name: Run Pipeline
# env:
# BASIC_AUTHS: ${{ secrets.BASIC_AUTHS }}
# HDX_KEY: ${{ secrets.HDX_BOT_SCRAPERS_API_TOKEN }}
# run: python3.11 -m hapi.pipelines.app -db "postgresql+psycopg://postgres:postgres@localhost:5432/hapi"

- name: Dump PostgreSQL Views
run: |
./dump_views.sh
# - name: Dump PostgreSQL Views
# run: |
# ./dump_views.sh

- name: Commit updated DB export
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: db-export
folder: database
target-folder: database
# - name: Commit updated DB export
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# branch: db-export
# folder: database
# target-folder: database

- name: Archive warnings and errors
uses: actions/upload-artifact@v4
with:
name: warnings-errors
path: warnings_errors.log
# - name: Archive warnings and errors
# uses: actions/upload-artifact@v4
# with:
# name: warnings-errors
# path: warnings_errors.log

- name: Send mail
if: failure()
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{secrets.EMAIL_SERVER}}
server_port: ${{secrets.EMAIL_PORT}}
username: ${{secrets.EMAIL_USERNAME}}
password: ${{secrets.EMAIL_PASSWORD}}
subject: "FAILED: ${{github.repository}} database export job"
body: GitHub Actions database export job for ${{github.repository}} failed!
to: ${{secrets.EMAIL_LIST}}
from: ${{secrets.EMAIL_FROM}}
content_type: text/html
- name: Send slack message
# if: failure()
run: |
RUN_URL="https://github.com/hapi-pipelines-prod/actions/runs/${{ github.run_id }}"
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"Build failed! Check the run details: ${RUN_URL}\"}" \
${{ secrets.SLACK_WEBHOOK_URL }}

0 comments on commit d3dcfad

Please sign in to comment.