From 50a22f89437abea0bb5e18cbe7a5f17605a4ff76 Mon Sep 17 00:00:00 2001 From: Krille Date: Tue, 15 Apr 2025 15:05:38 +0200 Subject: [PATCH] chore: Add matrix notifications for issues Signed-off-by: Krille --- .github/workflows/matrix_notification.yaml | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/matrix_notification.yaml diff --git a/.github/workflows/matrix_notification.yaml b/.github/workflows/matrix_notification.yaml new file mode 100644 index 000000000..106cb781c --- /dev/null +++ b/.github/workflows/matrix_notification.yaml @@ -0,0 +1,27 @@ +name: Matrix Notification + +on: + issues: + types: [ opened ] + issue_comment: + types: [ created ] + +jobs: + notify: + runs-on: ubuntu-latest + + steps: + - name: Send Matrix Notification + env: + MATRIX_URL: https://matrix.org/_matrix/client/v3/rooms/${{ secrets.MATRIX_MANAGEMENT_ROOM }}/send/m.room.message + MATRIX_ACCESS_TOKEN: ${{ secrets.MATRIX_BOT_TOKEN + run: | + if [ "${{ github.event_name }}" == "issues" ]; then + PAYLOAD="{\"msgtype\": \"m.text\", \"body\": \"New Issue Created: ${{ github.event.issue.title }}\\nCreated by: ${{ github.event.issue.user.login }}\\n${{ github.event.issue.body }}\\nURL: ${{ github.event.issue.html_url }}\"}" + else + PAYLOAD="{\"msgtype\": \"m.text\", \"body\": \"New Comment from ${{ github.event.comment.user.login }}\\n${{ github.event.comment.body }}\\nURL: ${{ github.event.comment.html_url }}\"}" + fi + curl -XPOST -H "Authorization: Bearer $MATRIX_ACCESS_TOKEN" \ + -H "Content-Type: application/json" \ + -d "$PAYLOAD" \ + $MATRIX_URL