From 9856863b03b59a6ff7ab5db2abd8cd5892226ea2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 13 Jul 2023 12:21:41 +0100 Subject: [PATCH] Update update-topics.yaml --- .github/workflows/update-topics.yaml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/update-topics.yaml b/.github/workflows/update-topics.yaml index 7c31e72448..2704d9d539 100644 --- a/.github/workflows/update-topics.yaml +++ b/.github/workflows/update-topics.yaml @@ -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); }); }