diff --git a/.github/workflows/hyperforge_workflow.yaml b/.github/workflows/hyperforge_workflow.yaml index 91c50fc..8e526b3 100644 --- a/.github/workflows/hyperforge_workflow.yaml +++ b/.github/workflows/hyperforge_workflow.yaml @@ -131,3 +131,34 @@ jobs: run: | docker push "ghcr.io/$REPOSITORY_OWNER/hyperforge:$IMAGE_SHA_TAG" docker push "ghcr.io/$REPOSITORY_OWNER/hyperforge:$IMAGE_REF_TAG" + + notify-teams-fail: + name: Notify Teams on failure + needs: + - test + - build_wheels + - build_and_push_docker_image + if: (failure() || cancelled()) && github.event_name == 'push' + runs-on: ubuntu-24.04 + steps: + - name: Send Teams notification + env: + REF_NAME: ${{ github.ref_name }} + RUN_NUMBER: ${{ github.run_number }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + COMMIT_SHA: ${{ github.sha }} + TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} + run: | + curl -s -o /dev/null -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -d "{ + \"@type\": \"MessageCard\", + \"@context\": \"http://schema.org/extensions\", + \"themeColor\": \"FF0000\", + \"summary\": \"Hyperforge CI failed\", + \"sections\": [{ + \"activityTitle\": \"**Hyperforge CI failed on \`${REF_NAME}\`**\", + \"activityText\": \"Run [#${RUN_NUMBER}](${RUN_URL}) failed for commit \`${COMMIT_SHA}\`.\" + }] + }" \ + "$TEAMS_WEBHOOK_URL"