diff --git a/README.md b/README.md index 54c413b..1d7f4ac 100644 --- a/README.md +++ b/README.md @@ -156,21 +156,41 @@ 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. 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. 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: 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 +``` + +`expires_in_ms` must be `null`. `GET /_matrix/client/v3/account/whoami` with the token checks it later. ## Versioning