Skip to content

Commit

Permalink
docs: add template example slack (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
thedaviddias committed Aug 3, 2023
1 parent 6a0356c commit fca8630
Showing 1 changed file with 55 additions and 2 deletions.
57 changes: 55 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
steps:

- name: Release Notification
uses: thedaviddias/publish-release-info-action@v1.1.1
uses: thedaviddias/publish-release-info-action@vX.X.X
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: https://hooks.slack.com/services/XXXXXX/XXXXX/XXXXXXX
Expand Down Expand Up @@ -113,12 +113,65 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Release Notification
uses: thedaviddias/publish-release-info-action@v1.1.1
uses: thedaviddias/publish-release-info-action@vX.X.X
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

```

### Example Workflow with Custom Slack template

We can use the output from `publish-relase-info-action` and use in combinaison with other actions like [slack-send](https://github.com/marketplace/actions/slack-send) in case you want to use a custom notification template.

```yaml
name: Deploy to production

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
release:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Release Notification
uses: thedaviddias/[email protected]
id: release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Post to a Slack channel
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: 'CHANNEL_ID'
payload: |
{
"text": "New release!",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Project:*\n<${{ steps.release.outputs.repoLink }}|${{ steps.release.outputs.repo}}>",
},
{
"type": "mrkdwn",
"text": "*Version:*\n<${{ steps.release.outputs.releaseLink }}|${{ steps.release.outputs.releaseVersion }}>",
}
]
}
]
}
```

## Contributors

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
Expand Down

0 comments on commit fca8630

Please sign in to comment.