Skip to content

Commit

Permalink
Merge pull request #1 from ho-nl/feature/notifyOnFailure
Browse files Browse the repository at this point in the history
Feature/notify on failure
  • Loading branch information
Renzovh authored Nov 28, 2023
2 parents f5a38b6 + e6fcc01 commit 50a6c4b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/notify-slack-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
time:
required: true
type: string
notifyOnlyOnFailure:
required: true
type: boolean
result:
required: true
type: string
Expand All @@ -18,6 +21,7 @@ on:
jobs:
notify-start:
name: Notify release end
if: ${{ inputs.notifyOnlyOnFailure == false || inputs.result != 'success' }}
runs-on: ubuntu-latest
steps:
- name: Set environment variables
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/notify-slack-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
channel:
required: true
type: string
notifyOnlyOnFailure:
required: true
type: boolean
outputs:
time:
description: "Start of the release in seconds"
Expand All @@ -16,6 +19,7 @@ on:
jobs:
notify-start:
name: Notify release start
if: ${{ inputs.notifyOnlyOnFailure == false}}
runs-on: ubuntu-latest
outputs:
output: ${{ steps.time.outputs.time }}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
slackToken: ${{ secrets.SLACK_BOT_RELEASE_TOKEN}}
with:
channel: YOUR_CHANNEL_TO_POST_MESSAGES
notifyOnlyOnFailure: boolean

# This would be your actual deployment job
release:
Expand All @@ -39,6 +40,7 @@ jobs:
time: ${{ needs.notify-start.outputs.time }}
result: ${{ needs.release.result }}
channel: YOUR_CHANNEL_TO_POST_MESSAGES
notifyOnlyOnFailure: boolean
```
![image](https://github.com/ho-nl/release-slack-action/assets/5382391/fcc383c9-533f-4a17-8be5-8a5202cedffd)
Expand Down

0 comments on commit 50a6c4b

Please sign in to comment.