From 39991699c9f8372f8a1cf6cd05fa3fba9da9cd3d Mon Sep 17 00:00:00 2001 From: s3krit Date: Mon, 12 Oct 2020 13:24:14 +0200 Subject: [PATCH 1/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ee35009..20e4860 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - name: send message - uses: s3krit/matrix-message-action@v0.0.1 + uses: s3krit/matrix-message-action@v0.0.3 with: room_id: ${{ secrets.MATRIX_ROOM_ID }} access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} From 70ad3fb812ee0e45ff8999d6af11cafad11a6ecf Mon Sep 17 00:00:00 2001 From: s3krit Date: Mon, 12 Oct 2020 13:25:20 +0200 Subject: [PATCH 2/5] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 20e4860..e225955 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,7 @@ Sending messages requires generating of an access token, which can be done with The Room ID does not refer to the room's name, but its unique ID. In Riot, this can be found by navigating to 'Room Settings' -> 'Advanced'. -`formatted_message` is optional, and accepts Matrix HTML-formatted message. If -it is not specified, only the `message` argument will be sent. +Markdown-formatted messages are supported. ```workflow name: Send a hello world to matrix every 5 minutes @@ -28,6 +27,5 @@ jobs: room_id: ${{ secrets.MATRIX_ROOM_ID }} access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} message: "Hello, world" - formatted_message: "Hello
world!" server: "matrix.org" ``` From 47821146231c6362a51e19dadf7064ba6db31ab3 Mon Sep 17 00:00:00 2001 From: Ola Bini Date: Mon, 8 Feb 2021 19:36:58 +0000 Subject: [PATCH 3/5] Update to add subject as a possible parameter --- README.md | 5 +++-- action.yml | 8 ++++++-- entrypoint.sh | 11 ++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e225955..5c7549a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Matrix Message github action -This is a simple github action to send messages to matrix servers. +This is a simple github action to send messages with subjects to matrix servers. ## Usage @@ -22,10 +22,11 @@ jobs: runs-on: ubuntu-latest steps: - name: send message - uses: s3krit/matrix-message-action@v0.0.3 + uses: olabiniV2/matrix-message-action@v0.0.1 with: room_id: ${{ secrets.MATRIX_ROOM_ID }} access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} + subject: "Something" message: "Hello, world" server: "matrix.org" ``` diff --git a/action.yml b/action.yml index dc416c4..cbfe469 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: matrix-message -description: Send a message to a matrix channel +description: Send a message with subject to a matrix channel author: Martin Pugh (pugh@s3kr.it) inputs: server: @@ -15,9 +15,13 @@ inputs: default: "" required: true message: - description: "Message to send in plaintext format" + description: "Message to send in markdown or html format" default: "" required: true + subject: + description: "Subject of message in plaintext format" + default: "" + required: false runs: using: docker image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 8210fa2..4cdcf84 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,8 +2,12 @@ # structure_message $content $formatted_content (optional) structure_message() { + subject="$2" + if [ -z "$subject" ]; then + subject="$1" + fi parsed="$(echo "$1" | markdown)" - body=$(jq -Rs --arg body "$1" --arg formatted_body "$parsed" '{"msgtype": "m.text", $body, "format": "org.matrix.custom.html", $formatted_body}' < /dev/null) + body=$(jq -Rs --arg body "$subject" --arg formatted_body "$parsed" '{"msgtype": "m.text", $body, "format": "org.matrix.custom.html", $formatted_body}' < /dev/null) echo "$body" } @@ -18,5 +22,6 @@ send_message() { exit 1 fi } -echo "$INPUT_MESSAGE" -send_message "$(structure_message "$INPUT_MESSAGE")" "$INPUT_ROOM_ID" "$INPUT_ACCESS_TOKEN" +echo "Subject: $INPUT_SUBJECT" +echo "Message: $INPUT_MESSAGE" +send_message "$(structure_message "$INPUT_MESSAGE" "$INPUT_SUBJECT")" "$INPUT_ROOM_ID" "$INPUT_ACCESS_TOKEN" From 5927bc6d98755e4364377fcfe0074aacbc01d237 Mon Sep 17 00:00:00 2001 From: Ola Bini Date: Mon, 8 Feb 2021 19:47:30 +0000 Subject: [PATCH 4/5] Change name --- README.md | 8 +++++++- action.yml | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5c7549a..fcb42b9 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: send message - uses: olabiniV2/matrix-message-action@v0.0.1 + uses: olabiniV2/matrix-msg-action@v0.0.1 with: room_id: ${{ secrets.MATRIX_ROOM_ID }} access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} @@ -30,3 +30,9 @@ jobs: message: "Hello, world" server: "matrix.org" ``` + + +## Credits + +This project was primarily created by Martin Pugh (pugh@s3kr.it). This version is a very slight change that might be +contributed back soon. diff --git a/action.yml b/action.yml index cbfe469..a2a842d 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,6 @@ -name: matrix-message +name: matrix-msg description: Send a message with subject to a matrix channel -author: Martin Pugh (pugh@s3kr.it) +author: Ola Bini (ola@olabini.se) inputs: server: description: "Matrix server hostname" From d0f9aa4c8310c3cedd11834e8c54c989492759f3 Mon Sep 17 00:00:00 2001 From: Ola Bini Date: Mon, 8 Feb 2021 20:06:27 +0000 Subject: [PATCH 5/5] Sort out the instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fcb42b9..94e9100 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: send message - uses: olabiniV2/matrix-msg-action@v0.0.1 + uses: olabiniV2/matrix-message@v0.0.1 with: room_id: ${{ secrets.MATRIX_ROOM_ID }} access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}