Update update-topics.yaml

pull/25800/head
Michael Telatynski 2023-07-13 12:21:41 +01:00 committed by GitHub
parent 231d3387e6
commit 9856863b03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 7 deletions

View File

@ -21,9 +21,6 @@ jobs:
runs-on: ubuntu-latest
environment: Matrix
steps:
- id: stable
uses: fangqiuming/latest-release-version@3225574bda429695112385003694f43c51f93635 # forked
- uses: actions/github-script@v6
env:
HS_URL: ${{ secrets.BETABOT_HS_URL }}
@ -31,10 +28,18 @@ jobs:
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 }}"
RELEASE_STATUS: "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 { HS_URL, TOKEN, RELEASE_STATUS, LOBBY_ROOM_ID, PUBLIC_ROOM_ID, ANNOUNCEMENT_ROOM_ID } = process.env;
const repo = context.repo;
const { data } = await octokit.rest.repos.getLatestRelease({
owner: repo.owner,
repo: repo.repo,
});
const releaseTopic = `Stable: ${{ data.tag_name }} | ${RELEASE_STATUS}`;
const regex = /Stable: v(\d+.\d+.\d+) \| Release status: (\w+) expected (\w+ \d+\w+)/gm;
@ -56,14 +61,14 @@ jobs:
});
const data = await res.json();
const topic = data.topic.replace(regex, RELEASE_TOPIC);
const topic = data.topic.replace(regex, releaseTopic);
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);
d.body = d.body.replace(regex, releaseTopic);
});
}