From 93d4764ed1ce6508c0668c1188747b78cb0305d1 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 9 Nov 2023 16:55:23 -0500 Subject: [PATCH] Add Slack notification --- .github/workflows/close-milestone-on-release.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/close-milestone-on-release.yml b/.github/workflows/close-milestone-on-release.yml index 223ef63..99658db 100644 --- a/.github/workflows/close-milestone-on-release.yml +++ b/.github/workflows/close-milestone-on-release.yml @@ -22,14 +22,24 @@ jobs: steps: - name: Close Milestone + id: milestone-id run: | TAG=${{ inputs.releaseTag }} export MILESTONE_NAME=${TAG#v} MILESTONE_ID=$(gh api repos/$OWNER/$REPO/milestones --jq '.[] | select(.title == env.MILESTONE_NAME) | .number') - gh api -X PATCH repos/$OWNER/$REPO/milestones/$MILESTONE_ID -f state='closed' --silent + if [ $MILESTONE_ID ]; then + gh api -X PATCH repos/$OWNER/$REPO/milestones/$MILESTONE_ID -f state='closed' --silent + fi + echo version=$MILESTONE_NAME >> $GITHUB_OUTPUT env: GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} OWNER: ${{ github.repository_owner }} REPO: ${{ github.event.repository.name }} - + - name: Announce Release on Slack + uses: slackapi/slack-github-action@v1.24.0 + env: + SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + with: + slack-message: ${{ github.event.repository.name }}-announcing `${{ steps.milestone-id.outputs.version }}`