From: Luchian Nemes Date: Thu, 24 Sep 2020 07:12:11 +0000 (+0300) Subject: (MODULES-10815) Add Slack notification for daily test run X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=776c28a835acf23b7844e09990a5100d2065d218;p=puppet-mailalias_core.git (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. --- 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': '', \ + },\ + {\ + '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: ', \ + },\ + ],\ + }\ + " \ + ${{ secrets.SLACK_WEBHOOK_URL }}