Skip to content

Commit

Permalink
Add Slack Notification step
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouball committed Dec 13, 2023
1 parent ecfde3f commit 7ecf17b
Showing 1 changed file with 34 additions and 11 deletions.
45 changes: 34 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.2', head, jruby-head]
# ruby: ['3.0', '3.2', head, jruby-head]
ruby: ['3.0', '3.2', head]
operating-system: [ubuntu-latest]
include:
- ruby: '3.0'
operating-system: windows-latest
- ruby: jruby-head
operating-system: windows-latest
# include:
# - ruby: '3.0'
# operating-system: windows-latest
# - ruby: jruby-head
# operating-system: windows-latest

name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
runs-on: ${{ matrix.operating-system }}
Expand All @@ -36,16 +37,38 @@ jobs:
- name: Run rake
run: bundle exec rake

- name: Fail if building with Ruby 3.0
if: matrix.ruby == '3.0'
run: exit 1

# - name: Slack Failure Notification
# uses: 8398a7/action-slack@v3
# with:
# status: ${{ job.status }}
# author_name: Build
# fields: all
# mention: here
# if_mention: 'failure, cancelled'
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
# if: failure() # Pick up events even if the job fails or is canceled.

- name: Slack Failure Notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Build
fields: all
mention: here
if_mention: 'failure, cancelled'
fields: workflow,job,commit,repo,ref,author,took
custom_payload: |
{
attachments: [
{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
text: `${process.env.AS_WORKFLOW}\n${process.env.AS_JOB} (${process.env.AS_COMMIT}) of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} ${{ job.status }} in ${process.env.AS_TOOK}`,
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: failure() # Pick up events even if the job fails or is canceled.

coverage:
Expand Down

0 comments on commit 7ecf17b

Please sign in to comment.