Skip to content

Commit

Permalink
Poster feil til slack vid github action failures
Browse files Browse the repository at this point in the history
  • Loading branch information
blommish committed Nov 29, 2024
1 parent 5b7e004 commit fd1db4c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
schedule:
# Runs at 04:00 UTC on the 1st and 17th of every month
- cron: "0 4 1,15 * *"

jobs:
backup-production-dataset:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -42,4 +43,11 @@ jobs:
name: Backup production dataset ${{ env.BACKUP_FILENAME }}
path: backups/${{ env.BACKUP_FILENAME }}
# Fails the workflow if no files are found; defaults to 'warn'
if-no-files-found: error
if-no-files-found: error

- name: Post build failures to Slack
if: failure()
run: |
curl -X POST --data "{\"text\": \"Backup av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
9 changes: 8 additions & 1 deletion .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ jobs:
- name: Deploy sanity
env:
SANITY_AUTH_TOKEN: ${{ secrets.SANITY_DEPLOY_TOKEN }}
run: sanity deploy
run: sanity deploy

- name: Post build failures to Slack
if: failure()
run: |
curl -X POST --data "{\"text\": \"Deploy av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 comments on commit fd1db4c

Please sign in to comment.