Skip to content

Commit

Permalink
Merge pull request #2 from ho-nl/feature/custom-message
Browse files Browse the repository at this point in the history
feat: allow usage of custom message in the slack message
  • Loading branch information
wimvdputten authored May 2, 2024
2 parents 50a6c4b + 5529ad7 commit 12968bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/notify-slack-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Release
on:
workflow_call:
inputs:
message:
required: false
type: string
channel:
required: true
type: string
Expand Down Expand Up @@ -47,7 +50,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.event.repository.name }} - Action - ${{ github.workflow }}* \n <${{ github.event.repository.url }}/commit/${{ github.sha }} | ${{ env.cut_sha }}> (<${{ github.event.repository.url }}/actions/runs/${{ github.run_id }} | open>)"
"text": "*${{ inputs.message && inputs.message || github.event.repository.name }} - ${{ github.workflow }}* \n <${{ github.event.repository.url }}/commit/${{ github.sha }} | ${{ env.cut_sha }}> (<${{ github.event.repository.url }}/actions/runs/${{ github.run_id }} | open>)"
}
},
{
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/notify-slack-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Release
on:
workflow_call:
inputs:
message:
required: false
type: string
channel:
required: true
type: string
Expand Down Expand Up @@ -45,7 +48,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.event.repository.name }} - Action - ${{ github.workflow }}* 🚀 \n <${{ github.event.repository.url }}/commit/${{ github.sha }} | ${{ env.cut_sha }}> (<${{ github.event.repository.url }}/actions/runs/${{ github.run_id }} | open>)"
"text": "*${{ inputs.message && inputs.message || github.event.repository.name }} - ${{ github.workflow }}* 🚀 \n <${{ github.event.repository.url }}/commit/${{ github.sha }} | ${{ env.cut_sha }}> (<${{ github.event.repository.url }}/actions/runs/${{ github.run_id }} | open>)"
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
secrets:
slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN}}
with:
message: CUSTOM_MESSAGE (optional if no message is provided, the repository name will be used)
channel: YOUR_CHANNEL_TO_POST_MESSAGES
notifyOnlyOnFailure: boolean

Expand All @@ -39,6 +40,7 @@ jobs:
with:
time: ${{ needs.notify-start.outputs.time }}
result: ${{ needs.release.result }}
message: CUSTOM_MESSAGE (optional if no message is provided, the repository name will be used)
channel: YOUR_CHANNEL_TO_POST_MESSAGES
notifyOnlyOnFailure: boolean
```
Expand Down

0 comments on commit 12968bd

Please sign in to comment.