Skip to content

Commit c420598

Browse files
committed
Test build failure notification
1 parent 67a485b commit c420598

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/pre-merge.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
fi
9393
9494
echo "urls=$urls" >> "$GITHUB_OUTPUT"
95+
exit 1
9596
9697
notify-slack:
9798
runs-on: ubuntu-latest
@@ -110,4 +111,19 @@ jobs:
110111
. ${GITHUB_WORKSPACE}/.github/actions/common/func.sh
111112
112113
echo "$image_urls" | slack_format_docker_image_urls_message "${{ inputs.release_tag }}" "$footer" \
114+
| curl -s --fail-with-body -d@- "${{ secrets.SLACK_WEB_HOOK_URL }}"
115+
116+
notify-slack-when-failed:
117+
runs-on: ubuntu-latest
118+
needs: collect-image-urls
119+
if: ${{ inputs.release_tag && failure() }}
120+
steps:
121+
- name: Send Failure Slack notification
122+
run: |
123+
workflow_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
124+
footer="Repository: ${{ github.repository }} | Commit: \`${{ github.sha }}\`"
125+
126+
. ${GITHUB_WORKSPACE}/.github/actions/common/func.sh
127+
128+
slack_format_failure_message "Docker Build failed for Redis: ${{ steps.parse-release.outputs.release_version || 'unknown'}}" "$workflow_url" "$footer" \
113129
| curl -s --fail-with-body -d@- "${{ secrets.SLACK_WEB_HOOK_URL }}"

0 commit comments

Comments
 (0)