1
0
Просмотр исходного кода

ci(release): add email notification on failure for main branch (#8126)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
ᴊᴏᴇ ᴄʜᴇɴ 1 неделя назад
Родитель
Сommit
fc6d1e2055
1 измененных файлов с 22 добавлено и 0 удалено
  1. 22 0
      .github/workflows/release.yml

+ 22 - 0
.github/workflows/release.yml

@@ -132,3 +132,25 @@ jobs:
           if [ "${{ matrix.goos }}" = "linux" ]; then
             gh release upload "$RELEASE_TAG" dist/gogs_*.tar.gz --clobber
           fi
+
+  notify-failure:
+    name: Notify on failure
+    runs-on: ubuntu-latest
+    needs: [build]
+    if: ${{ failure() && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
+    steps:
+      - name: Send email on failure
+        uses: dawidd6/action-send-mail@2cea9617b09d79a095af21254fbcb7ae95903dde # v3.12.0
+        with:
+          server_address: smtp.mailgun.org
+          server_port: 465
+          username: ${{ secrets.SMTP_USERNAME }}
+          password: ${{ secrets.SMTP_PASSWORD }}
+          subject: GitHub Actions (${{ github.repository }}) job result
+          to: github-actions-8ce6454@unknwon.io
+          from: GitHub Actions (${{ github.repository }})
+          reply_to: noreply@unknwon.io
+          body: |
+            The job "${{ github.job }}" of ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} completed with "${{ job.status }}".
+
+            View the job run at: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}