From 992de69c5dad92a80a15a81c1adb99e33214887e Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Fri, 27 Sep 2024 13:00:57 +0200 Subject: [PATCH] ci: fix notification tasks --- .gitea/workflows/build.yaml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 16c216c..4aef87c 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Run Gitleaks - uses: docker://zricethezav/gitleaks:v8.18.4 + uses: docker://zricethezav/gitleaks:v8.19.3 with: args: detect --no-git --verbose --source ${{ github.workspace }} - name: Run hadolint @@ -25,17 +25,20 @@ jobs: # uses: sudo-bot/action-shellcheck@latest # with: # cli-args: "shell.sh" - - name: Send notification on error + - name: Send notification uses: dawidd6/action-send-mail@v3 - if: always() + if: failure() with: connection_url: smtp://docker10.mgrote.net:1025 secure: false ignore_cert: true to: michael.grote@posteo.de from: Gitea Actions - subject: "CI Error in ${{ env.GITHUB_REPOSITORY }}" - body: "Job of ${{ env.github.repository }} failed!" + subject: "CI ${{ job.status }} in ${{ github.repository }}" + body: | + Repo: ${{ github.repository }} + Job: ${{ github.action }} + Status: ${{ job.status }} build: needs: [gitleaks, hadolint] # shellcheck @@ -57,20 +60,23 @@ jobs: run: echo "REPO_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT id: extract_branch - name: Build and push Docker image - uses: https://github.com/docker/build-push-action@v5 + uses: https://github.com/docker/build-push-action@v6 with: context: . file: ./Dockerfile push: true tags: "registry.mgrote.net/${{ steps.meta.outputs.REPO_NAME }}:latest,registry.mgrote.net/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.extract_branch.outputs.REPO_BRANCH }}" - - name: Send notification on error + - name: Send notification uses: dawidd6/action-send-mail@v3 - if: always() + if: failure() with: connection_url: smtp://docker10.mgrote.net:1025 secure: false ignore_cert: true to: michael.grote@posteo.de from: Gitea Actions - subject: "CI Error in ${{ env.GITHUB_REPOSITORY }}" - body: Job of ${{ env.github.repository }} failed! + subject: "CI ${{ job.status }} in ${{ github.repository }}" + body: | + Repo: ${{ github.repository }} + Job: ${{ github.action }} + Status: ${{ job.status }}