Skip to content

Commit

Permalink
BRE-40 Add action for reporting upcoming release version to Slack (#281)
Browse files Browse the repository at this point in the history
* BRE-40 ADD action.yml file for reporting upcoming release version to Slack

* Update report-upcoming-release-version/action.yml

Co-authored-by: MtnBurrit0 <[email protected]>

* Update report-upcoming-release-version/action.yml

Co-authored-by: MtnBurrit0 <[email protected]>

* Update report-upcoming-release-version/action.yml

Co-authored-by: MtnBurrit0 <[email protected]>

* BRE-40 TEST: default Slack channel in report-upcoming-release-version/action.yml

* BRE-40 REFACTOR: Slack Message

* Revert "BRE-40 TEST: default Slack channel in report-upcoming-release-version/action.yml"

This reverts commit 05412fa.

* Revert "Revert "BRE-40 TEST: default Slack channel in report-upcoming-release-version/action.yml""

This reverts commit f9b0c9a.

* BRE-40 ADD: test-report-upcoming-release-version workflow

* BRE-40 REFACTOR: tag parameter in test-report-upcoming-release-version workflow

* BRE-40 REFACTOR: report-deployment-status-to-slack to report-upcoming-release-version in test-report-upcoming-release-version workflow

* Revert "Revert "Revert "BRE-40 TEST: default Slack channel in report-upcoming-release-version/action.yml"""

This reverts commit 3d783a9.

---------

Co-authored-by: MtnBurrit0 <[email protected]>
  • Loading branch information
urbinaalex17 and mimartin12 authored May 21, 2024
1 parent 3ced166 commit 56b095a
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/test-report-upcoming-release-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Test report-upcoming release version to Slack
on:
pull_request:
paths:
- "report-upcoming-release-version/**"
- ".github/workflows/test-report-upcoming-release-version.yml"

jobs:
test-report-upcoming-release-version:
name: Test report upcoming release version to Slack
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Report upcoming release version to Slack
uses: ./report-upcoming-release-version
with:
project: bitwarden/server
version: upcoming_version
slack-channel: devops-alerts-test
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
59 changes: 59 additions & 0 deletions report-upcoming-release-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Report release version to Slack"
description: "Report upcoming release version to Slack"
inputs:
project:
description: "The name of the project."
required: true
version:
description: "The upcoming version to release."
required: true
slack-channel:
description: "The name of the Slack channel."
default: release
AZURE_KV_CI_SERVICE_PRINCIPAL:
description: "The service principal used to authenticate to Azure."
required: true
outputs:
channel_id:
description: "Channel ID where the Slack message was posted."
value: ${{ steps.slack-message.outputs.channel_id }}

runs:
using: "composite"
steps:
- name: Login to Azure
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ inputs.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Retrieve Slack secrets
id: retrieve-slack-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: bitwarden-ci
secrets: "slack-bot-token"

- name: Slack message setup
id: setup
shell: bash
run: |
function slack_message_fn () {
local version="${{ inputs.version }}"
local project="${{ inputs.project }}"
SLACK_MESSAGE=":meow_attention: Upcoming release \`$version\` for \`$project\`."
}
slack_message_fn
echo "slack_message<<EOF" >> $GITHUB_OUTPUT
echo "$SLACK_MESSAGE" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Post message to a Slack channel
id: slack-message
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
with:
channel-id: ${{ inputs.slack-channel }}
slack-message: ${{ steps.setup.outputs.slack_message }}
env:
SLACK_BOT_TOKEN: ${{ steps.retrieve-slack-secrets.outputs.slack-bot-token }}

0 comments on commit 56b095a

Please sign in to comment.