+ 7f503db5e9d4c95c18db1f7757b2493e7a44a15e #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: notify | ||
|
Check failure on line 1 in .github/workflows/.notify.yml
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| job_name: | ||
| required: true | ||
| type: string | ||
| job_result: | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| SLACK_BOT_TOKEN: | ||
| required: false | ||
| jobs: | ||
| notify_slack: | ||
| if: ${{ inputs.job_result == 'failure' && github.repository == 'OpenSIPS/opensips' && secrets.SLACK_BOT_TOKEN != '' }} | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
| steps: | ||
| - name: Notify slack fail | ||
| uses: slackapi/slack-github-action@v3.0.3 | ||
| with: | ||
| method: chat.postMessage | ||
| token: ${{ env.SLACK_BOT_TOKEN }} | ||
| payload: | | ||
| channel: devel | ||
| text: ":x: ${{ inputs.job_name }} failed in ${{ github.repository }}" | ||
| blocks: | ||
| - type: section | ||
| text: | ||
| type: mrkdwn | ||
| text: ":x: *${{ inputs.job_name }}* failed in *${{ github.repository }}*" | ||
| - type: context | ||
| elements: | ||
| - type: mrkdwn | ||
| text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Open this run in GitHub Actions>" | ||
| - name: Post Fail | ||
| run: | | ||
| echo "💥 \"${{ inputs.job_name }}\" failed – marking workflow 💩" >&2 | ||
| exit 1 | ||