-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into kerry/25656/after-login-fragment
- Loading branch information
Showing
18 changed files
with
547 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Update release topics | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
expected_status: | ||
description: What type of release is the next expected release | ||
required: true | ||
default: RC | ||
type: choice | ||
options: | ||
- RC | ||
- Release | ||
expected_date: | ||
description: Expected release date e.g. July 11th | ||
required: true | ||
type: string | ||
concurrency: ${{ github.workflow }} | ||
jobs: | ||
bot: | ||
name: Release topic update | ||
runs-on: ubuntu-latest | ||
environment: Matrix | ||
steps: | ||
- id: stable | ||
uses: fangqiuming/latest-release-version@45b2da0e20968cd18c356c548d3c5ccb7318bb8f | ||
|
||
- uses: actions/github-script@v6 | ||
env: | ||
HS_URL: ${{ secrets.BETABOT_HS_URL }} | ||
LOBBY_ROOM_ID: ${{ secrets.ROOM_ID }} | ||
PUBLIC_ROOM_ID: "!YTvKGNlinIzlkMTVRl:matrix.org" | ||
ANNOUNCEMENT_ROOM_ID: "!bijaLdadorKgNGtHdA:matrix.org" | ||
TOKEN: ${{ secrets.BETABOT_ACCESS_TOKEN }} | ||
RELEASE_TOPIC: "Stable: ${{ steps.stable.outputs.tag_name }} | Release status: ${{ inputs.expected_status }} expected ${{ inputs.expected_date }}" | ||
with: | ||
script: | | ||
const { HS_URL, TOKEN, RELEASE_TOPIC, LOBBY_ROOM_ID, PUBLIC_ROOM_ID, ANNOUNCEMENT_ROOM_ID } = process.env; | ||
const regex = /Stable: v(\d+.\d+.\d+) \| Release status: (\w+) expected (\w+ \d+\w+)/gm; | ||
async function updateReleaseInTopic(roomId) { | ||
const apiUrl = `${HS_URL}/_matrix/client/v3/rooms/${roomId}/state/m.room.topic/`; | ||
const headers = { | ||
"Content-Type": "application/json", | ||
"Authorization": `Bearer ${TOKEN}`, | ||
}; | ||
await fetch(`${HS_URL}/_matrix/client/v3/rooms/${roomId}/join`, { | ||
method: "POST", | ||
headers, | ||
body: "{}", | ||
}); | ||
let res = await fetch(apiUrl, { | ||
method: "GET", | ||
headers, | ||
}); | ||
const data = await res.json(); | ||
const topic = data.topic.replace(regex, RELEASE_TOPIC); | ||
if (topic === data.topic) { | ||
console.log(roomId, "nothing to do"); | ||
return; | ||
} | ||
if (data["org.matrix.msc3765.topic"]) { | ||
data["org.matrix.msc3765.topic"].forEach(d => { | ||
d.body = d.body.replace(regex, RELEASE_TOPIC); | ||
}); | ||
} | ||
res = await fetch(apiUrl, { | ||
method: "PUT", | ||
body: JSON.stringify({ | ||
...data, | ||
topic, | ||
}), | ||
headers, | ||
}); | ||
if (res.ok) { | ||
console.log(roomId, "topic updated:", topic); | ||
} else { | ||
console.log(roomId, await res.text()); | ||
} | ||
} | ||
await updateReleaseInTopic(LOBBY_ROOM_ID); | ||
await updateReleaseInTopic(PUBLIC_ROOM_ID); | ||
await updateReleaseInTopic(ANNOUNCEMENT_ROOM_ID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.