From 804302ed532f85d78a751dc09f9e819c9211a896 Mon Sep 17 00:00:00 2001 From: Roy Ho Date: Fri, 27 May 2022 09:44:43 -0700 Subject: [PATCH] Add Slack notification for code freeze (#33217) Add Slack notification on code freeze --- .github/workflows/release-code-freeze.yml | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.github/workflows/release-code-freeze.yml b/.github/workflows/release-code-freeze.yml index eb645fbaabb..71dd29b0600 100644 --- a/.github/workflows/release-code-freeze.yml +++ b/.github/workflows/release-code-freeze.yml @@ -33,3 +33,45 @@ jobs: run: php release-code-freeze.php env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + notify-slack: + name: "Sends code freeze notification to Slack" + runs-on: ubuntu-20.04 + needs: maybe-create-next-milestone-and-release-branch + steps: + - name: Get outgoing release version + uses: actions/github-script@v6 + id: outgoing + with: + script: | + const latest = await github.rest.repos.getLatestRelease({ + owner: 'woocommerce', + repo: 'woocommerce' + }); + + let version = parseFloat( latest.data.tag_name ) + 0.1; + version = parseFloat( version ).toPrecision( 2 ); + + return version; + - name: Get next release version + uses: actions/github-script@v6 + id: next + with: + script: | + const latest = await github.rest.repos.getLatestRelease({ + owner: 'woocommerce', + repo: 'woocommerce' + }); + + let version = parseFloat( latest.data.tag_name ) + 0.2; + version = parseFloat( version ).toPrecision( 2 ); + + return version; + - name: Slack + uses: archive/github-actions-slack@v2.0.0 + id: notify + with: + slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }} + slack-channel: ${{ secrets.WOO_RELEASE_SLACK_CHANNEL }} + slack-text: ":warning-8c: ${{ steps.outgoing.outputs.result }} Code Freeze :ice_cube: +The automation to cut the release branch for ${{ steps.outgoing.outputs.result }} has run. Any PRs that were not already merged will be a part of ${{ steps.next.outputs.result }} by default. If you have something that needs to make ${{ steps.outgoing.outputs.result }} that hasn't yet been merged, please see the <${{ secrets.FG_LINK }}/code-freeze-for-woocommerce-core-release/|fieldguide page for the code freeze>."