Skip to content

Commit e1acb3b

Browse files
authored
Fix Matrix Room Topic Update (opencast#6827)
Our current Matrix roo topic updates are broken. The reason seems to be the API complaining about the HTTP call we do: ```json { "errcode":"M_NOT_JSON", "error":"Invalid Content-Type header: expected application/json" } ``` This should hopefully fix the problem. It also finally switches from using the actual username and password to just using a pre-generated token. ### Your pull request should… * [x] have a concise title * [x] [close an accompanying issue](https://docs.opencast.org/develop/developer/#participate/development-process/#automatically-closing-issues-when-a-pr-is-merged) if one exists * [x] [be against the correct branch](https://docs.opencast.org/develop/developer/development-process#acceptance-criteria-for-patches-in-different-versions) * [x] include migration scripts and documentation, if appropriate * [x] pass automated tests * [x] have a clean commit history * [x] [have proper commit messages (title and body) for all commits](https://medium.com/@steveamaza/e028865e5791) * [x] explain why it needs to be merged into the legacy branch, if it is targeting the legacy branch
2 parents 245fe12 + db87d02 commit e1acb3b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
on:
2+
workflow_dispatch:
23
push:
34
tags:
45
- '*.*'
@@ -11,17 +12,13 @@ jobs:
1112
steps:
1213
- name: update room description
1314
env:
14-
MATRIX_PASS: ${{ secrets.MATRIX_BOT_PASS }}
1515
MATRIX_USER: ${{ secrets.MATRIX_BOT_USER }}
16-
URL_LOGIN: 'https://matrix.org/_matrix/client/r0/login'
17-
URL_LOGOUT: 'https://matrix.org/_matrix/client/r0/logout'
16+
MATRIX_TOKEN: ${{ secrets.MATRIX_BOT_TOKEN }}
1817
URL_TOPIC: 'https://matrix-client.matrix.org/_matrix/client/r0/rooms/!HBsLKoOIEEOkxAeQvC%3Amatrix.org/state/m.room.topic/'
1918
run: |
2019
TAGS="$(curl https://api.github.com/repos/opencast/opencast/tags | jq -r '.[].name')"
2120
MAJOR="$(echo "$TAGS" | sed 's/\..*$//' | sort --version-sort | tail -n1)"
2221
STABLE="$(echo "$TAGS" | sort --version-sort | tail -n1)"
2322
LEGACY="$(echo "$TAGS" | grep -v "^${MAJOR}" | sort --version-sort | tail -n1)"
2423
TOPIC='{"topic":"opencast.org\n–\nLatest releases: '"$STABLE, $LEGACY"'\n–\nJoin the technical meeting: Tuesday, 3:15 pm UTC at meet.opencast.video (p: welcome)"}'
25-
TOKEN="$(curl -s -XPOST -d '{"type":"m.login.password", "user":"'"$MATRIX_USER"'", "password":"'"$MATRIX_PASS"'", "initial_device_display_name":"GitHub Actions"}' "$URL_LOGIN" | jq -r .access_token)"
26-
curl -s -XPUT -d "${TOPIC}" "${URL_TOPIC}?access_token=${TOKEN}"
27-
curl -s -XPOST "${URL_LOGOUT}?access_token=${TOKEN}"
24+
curl -s --fail -XPUT -H 'Content-Type: application/json' -d "${TOPIC}" "${URL_TOPIC}?access_token=${MATRIX_TOKEN}"

0 commit comments

Comments
 (0)