Skip to content

Commit

Permalink
ci: send message on release created and successfully validated (#1185)
Browse files Browse the repository at this point in the history
# Description
- Will send a message in Slack about a new release once it has finished
all dry-runs.
- Will send a new message per commit in `main`

Potential improvements:
- Update this message whenever the release is updated. We cannot specify
ID so we need to store this somewhere along with the PR-number..
- Add more actions to the message. "Approve" for example should just do
that. Approve the PR and merge it automatically.
- Add action to promote to production




<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new job that sends formatted notifications to Slack upon
successful deployment, enhancing communication regarding pull requests.

- **Bug Fixes**
- Minor formatting corrections made to improve the clarity of deployment
configurations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
arealmaas committed Oct 3, 2024
1 parent f8fe468 commit ea2400b
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci-cd-pull-request-release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,47 @@ jobs:
region: norwayeast
dryRun: true
version: ${{ needs.get-current-version.outputs.version }}-${{ needs.generate-git-short-sha.outputs.gitShortSha }}

send-slack-message:
name: Send Slack message
needs: [dry-run-deploy-infra-staging, dry-run-deploy-apps-staging]
runs-on: ubuntu-latest
steps:
- name: Slackify markdown in pull request body
id: slackify
uses: LoveToKnow/slackify-markdown-action@v1.1.1
with:
text: ${{ github.event.pull_request.body }}
- name: Send GitHub slack message
id: slack
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: slackapi/slack-github-action@v1.27.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID_FOR_RELEASES }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJson(steps.slackify.outputs.text) }}
}
},
{ "type": "divider" },
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Approve Release"
},
"url": "https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
}
]
}
]
}

0 comments on commit ea2400b

Please sign in to comment.