diff options
author | Luchian Nemes <luchian.nemes@puppet.com> | 2020-09-24 10:12:11 +0300 |
---|---|---|
committer | Luchian Nemes <luchian.nemes@puppet.com> | 2020-09-30 10:02:32 +0300 |
commit | 776c28a835acf23b7844e09990a5100d2065d218 (patch) | |
tree | 4c4632a2b348099b4bc989cad919a997de21e274 | |
parent | 650729a0cba581e0654d07eacd95ff8a111b85e2 (diff) | |
download | puppet-mailalias_core-776c28a835acf23b7844e09990a5100d2065d218.tar.gz puppet-mailalias_core-776c28a835acf23b7844e09990a5100d2065d218.tar.bz2 |
(MODULES-10815) Add Slack notification for daily test run
Starting with this commit, the daily `Unit Tests with nightly Puppet
gem` run will now send the job result via a Slack notification. The
Slack channel can be changed through the `SLACK_CHANNEL` from the GitHub
Secrets of the repository.
-rw-r--r-- | .github/workflows/daily_unit_tests_with_nightly_puppet_gem.yaml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/.github/workflows/daily_unit_tests_with_nightly_puppet_gem.yaml b/.github/workflows/daily_unit_tests_with_nightly_puppet_gem.yaml index b31bf18..303be8c 100644 --- a/.github/workflows/daily_unit_tests_with_nightly_puppet_gem.yaml +++ b/.github/workflows/daily_unit_tests_with_nightly_puppet_gem.yaml @@ -56,3 +56,51 @@ jobs: - name: Run unit tests run: bundle exec rake parallel_spec + + - name: Send Slack notification + if: always() + shell: bash + env: + success: '#43c78a' + failure: '#ed5c5c' + cancelled: '#343434' + run: | + curl -X POST --data-urlencode \ + "payload=\ + {\ + 'channel': '#${{ secrets.SLACK_CHANNEL }}', \ + 'attachments': \ + [\ + {\ + 'author_name': '${{ github.actor }}', \ + 'author_link': 'http://github.com/${{ github.actor }}', \ + 'author_icon': 'http://github.com/${{ github.actor }}.png?size=32', \ + 'color': '${{ env[job.status] }}', \ + 'fields': \ + [\ + {\ + 'title': 'Git reference', \ + 'value': '${{ github.ref }}', \ + 'short': true, \ + },\ + {\ + 'title': 'Event', \ + 'value': '${{ github.event_name }}', \ + 'short': true, \ + },\ + {\ + 'title': 'Workflow', \ + 'value': '<http://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>', \ + },\ + {\ + 'title': ':ci_${{ job.status}}: *${{ github.repository }}*', \ + 'value': 'The *${{ matrix.os_type }} / Puppet${{ matrix.puppet_version }} gem / Ruby ${{ matrix.ruby }}* run finished with status *${{ job.status }}*.', \ + 'short': false, \ + },\ + ],\ + 'footer': ':githublogo: Commit SHA: <http://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>', \ + },\ + ],\ + }\ + " \ + ${{ secrets.SLACK_WEBHOOK_URL }} |