File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -116,3 +116,34 @@ jobs:
116116 password : ${{ secrets.DOCKER_PASSWORD }}
117117 repository : layer5/kanvas-docker-extension
118118 readme-filepath : README.md
119+
120+ email-on-failure :
121+ needs : [docker-build]
122+ if : ${{ failure() }}
123+ runs-on : ubuntu-24.04
124+ steps :
125+ - name : Find failed jobs.
126+ run : |
127+ curl "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.conclusion == "failure") | "\(.name): \(.steps[] | select(.conclusion == "failure") | .name)\n\(.html_url)\n"' >> output.txt
128+ # Save multi-line environment variables by using the delimiters syntex.
129+ echo "EMAIL_BODY<<EOF" >> $GITHUB_ENV
130+ echo "$(cat ./output.txt)" >> $GITHUB_ENV
131+ echo "EOF" >> $GITHUB_ENV
132+ - name : Failed jobs summary
133+ run : |
134+ echo "${{ env.EMAIL_BODY }}"
135+ - name : Send Email Notification
136+ if : env.EMAIL_BODY != ''
137+ uses : dawidd6/action-send-mail@v6
138+ with :
139+ server_address : smtp.gmail.com
140+ server_port : 465
141+ username : ${{ secrets.MAIL_USERNAME }}
142+ password : ${{ secrets.MAIL_PASSWORD }}
143+ subject : Job(s) failure in the build-and-release-stable workflow
144+ to : support@layer5.io
145+ from : Docker Kanvas Extension Releaser
146+ body : |
147+ The workflow failed. Here are the details:
148+ ${{ env.EMAIL_BODY }}
149+ Workflow run log URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
You can’t perform that action at this time.
0 commit comments