From 075d44462793811ad2197b4159d9d5de2472c9e7 Mon Sep 17 00:00:00 2001 From: Lennard Golsch Date: Wed, 2 Dec 2026 14:14:55 +0100 Subject: [PATCH 1/3] docs: take the homeserver of the Matrix account and a token that does not expire --- README.md | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 54c413b..eb26ed5 100644 --- a/README.md +++ b/README.md @@ -156,21 +156,39 @@ Releases, version branches and the snapshot refresh are reported to a Matrix roo The room is set by organization variables, which the workflows read from the calling repository: -| Variable | Example | Content | -|---------------------|----------------------|-------------------------------------------| -| `MATRIX_HOMESERVER` | `https://matrix.org` | https base URL of the homeserver | -| `MATRIX_ROOM_ID` | `!AbCdEf:matrix.org` | Internal id of the room, see its settings | +| Variable | Example | Content | +|---------------------|------------------------------------|-----------------------------------------------------------------| +| `MATRIX_HOMESERVER` | `https://matrix-client.matrix.org` | https base URL of the homeserver of the sending account | +| `MATRIX_ROOM_ID` | `!AbCdEf…` | Internal id of the room, copied as Element shows it in settings | -The base URL is not the server name in the room id: it is `m.homeserver.base_url` of -`https:///.well-known/matrix/client`, e.g. `https://chat.example.org` for `example.org`. +The homeserver is the one of the sending account, the server name after the colon of its user id, e.g. `matrix.org` +for `@bot:matrix.org`. The room may be on another homeserver, the message reaches it by federation. The base URL is +`m.homeserver.base_url` of `https:///.well-known/matrix/client`, e.g. `https://matrix-client.matrix.org` +for `matrix.org`. Room ids of room version 12 and newer have no server name, copy the id without adding one, otherwise +the homeserver answers that the account is not in the room. A repository variable with the same name sends the messages of that repository to another room. Without the variables or without `MATRIX_ACCESS_TOKEN`, no message is sent and nothing fails. A homeserver that is not an https URL, or any answer of the homeserver but 2xx, fails the step with the answer in its error. The release and version branch workflows go on with `continue-on-error`, their result does not change. -The messages come from a separate Matrix account, which has to be a member of the room. Its access token is shown -in Element under Settings, Help & About. The room should not be end-to-end encrypted, as the messages are sent unencrypted. +The messages come from a separate Matrix account, which has to be invited to the room and join it. The room should not +be end-to-end encrypted, as the messages are sent unencrypted. + +The access token must not expire. Do not copy it from Element: on homeservers with the Matrix Authentication Service, +like `matrix.org`, that token is only valid for minutes. Log in a session of its own instead, its token starts with +`mct_` or `syt_` and is valid until the session is signed out. In bash, `read -p` does not work in zsh: + +```bash +read -rs -p 'Password: ' PASSWORD; echo +jq -n --arg password "$PASSWORD" '{type: "m.login.password", identifier: {type: "m.id.user", user: ""}, + password: $password, initial_device_display_name: "github-workflows"}' \ + | curl -sS -X POST -H 'Content-Type: application/json' -d @- \ + 'https://matrix-client.matrix.org/_matrix/client/v3/login' | jq '{user_id, expires_in_ms, access_token}' +unset PASSWORD +``` + +`expires_in_ms` must be `null`. `GET /_matrix/client/v3/account/whoami` with the token checks it later. ## Versioning From 4d002b57316cc990c735749db11ee05e0c9edfe3 Mon Sep 17 00:00:00 2001 From: Lennard Golsch Date: Wed, 2 Dec 2026 14:16:25 +0100 Subject: [PATCH 2/3] docs: expire only tokens of Element sessions of the authentication service, keep the password out of argv --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index eb26ed5..b346a7f 100644 --- a/README.md +++ b/README.md @@ -175,14 +175,15 @@ version branch workflows go on with `continue-on-error`, their result does not c The messages come from a separate Matrix account, which has to be invited to the room and join it. The room should not be end-to-end encrypted, as the messages are sent unencrypted. -The access token must not expire. Do not copy it from Element: on homeservers with the Matrix Authentication Service, -like `matrix.org`, that token is only valid for minutes. Log in a session of its own instead, its token starts with -`mct_` or `syt_` and is valid until the session is signed out. In bash, `read -p` does not work in zsh: +The access token must not expire. A token copied from Element can: if Element logged in through the Matrix +Authentication Service, as on `matrix.org`, its token starts with `mat_` and is only valid for minutes. Log in a session +of its own instead, its token starts with `mct_` or `syt_` and is valid until the session is signed out. Run it in bash, +`read -p` means something else in zsh: ```bash read -rs -p 'Password: ' PASSWORD; echo -jq -n --arg password "$PASSWORD" '{type: "m.login.password", identifier: {type: "m.id.user", user: ""}, - password: $password, initial_device_display_name: "github-workflows"}' \ +PASSWORD="$PASSWORD" jq -n '{type: "m.login.password", identifier: {type: "m.id.user", user: ""}, + password: env.PASSWORD, initial_device_display_name: "github-workflows"}' \ | curl -sS -X POST -H 'Content-Type: application/json' -d @- \ 'https://matrix-client.matrix.org/_matrix/client/v3/login' | jq '{user_id, expires_in_ms, access_token}' unset PASSWORD From f3465c717ef6557ca73c19954ffb597266b95b2e Mon Sep 17 00:00:00 2001 From: Lennard Golsch Date: Wed, 2 Dec 2026 14:18:30 +0100 Subject: [PATCH 3/3] docs: name the localpart and the password the Matrix login needs --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b346a7f..1d7f4ac 100644 --- a/README.md +++ b/README.md @@ -176,13 +176,14 @@ The messages come from a separate Matrix account, which has to be invited to the be end-to-end encrypted, as the messages are sent unencrypted. The access token must not expire. A token copied from Element can: if Element logged in through the Matrix -Authentication Service, as on `matrix.org`, its token starts with `mat_` and is only valid for minutes. Log in a session -of its own instead, its token starts with `mct_` or `syt_` and is valid until the session is signed out. Run it in bash, -`read -p` means something else in zsh: +Authentication Service, as on `matrix.org`, its token starts with `mat_` and is only valid for minutes. If the account +has a password, log in a session of its own instead, its token starts with `mct_` or `syt_` and is valid until the +session is signed out. Run it in bash, `read -p` means something else in zsh, with the localpart of the account, e.g. +`bot` for `@bot:matrix.org`: ```bash read -rs -p 'Password: ' PASSWORD; echo -PASSWORD="$PASSWORD" jq -n '{type: "m.login.password", identifier: {type: "m.id.user", user: ""}, +PASSWORD="$PASSWORD" jq -n '{type: "m.login.password", identifier: {type: "m.id.user", user: ""}, password: env.PASSWORD, initial_device_display_name: "github-workflows"}' \ | curl -sS -X POST -H 'Content-Type: application/json' -d @- \ 'https://matrix-client.matrix.org/_matrix/client/v3/login' | jq '{user_id, expires_in_ms, access_token}'