From 13bd504f17a21b32615c279a11a03a18092930cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Sat, 28 Feb 2026 12:04:30 +0100 Subject: [PATCH] chore: Add matrix notify workflow --- .github/workflows/matrix_notify.yaml | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/matrix_notify.yaml diff --git a/.github/workflows/matrix_notify.yaml b/.github/workflows/matrix_notify.yaml new file mode 100644 index 000000000..6685cad16 --- /dev/null +++ b/.github/workflows/matrix_notify.yaml @@ -0,0 +1,49 @@ +name: Matrix Notification + +on: + issues: + types: [opened] + pull_request: + types: [opened] + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Send notification to Matrix room + env: + HOMESERVER: ${{ secrets.MATRIX_HOMESERVER }} + ACCESS_TOKEN: ${{ secrets.MATRIX_ACCESS_TOKEN }} + ROOM_ID: ${{ secrets.MATRIX_ROOM_ID }} + EVENT_NAME: ${{ github.event_name }} + ISSUE_TITLE: ${{ github.event.issue.title }} + ISSUE_URL: ${{ github.event.issue.html_url }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_URL: ${{ github.event.pull_request.html_url }} + run: | + if [ "${EVENT_NAME}" = "issues" ]; then + PREFIX="New issue" + TITLE="${ISSUE_TITLE}" + URL="${ISSUE_URL}" + else + PREFIX="New pull request" + TITLE="${PR_TITLE}" + URL="${PR_URL}" + fi + + PLAIN="${PREFIX}: ${TITLE} - ${URL}" + HTML="${PREFIX}: ${TITLE} - ${URL}" + TXN_ID=$(date +%s%N) + + curl -s -o /dev/null -w "%{http_code}" -X PUT \ + "${HOMESERVER}/_matrix/client/v3/rooms/${ROOM_ID}/send/m.room.message/${TXN_ID}" \ + -H "Authorization: Bearer ${ACCESS_TOKEN}" \ + -H "Content-Type: application/json" \ + -d @- <