Skip to content

Commit

Permalink
Post to Slack when ci.yml fails on main
Browse files Browse the repository at this point in the history
  • Loading branch information
seanh committed Sep 19, 2023
1 parent 64c9aed commit 0195ac0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions _shared/project/.github/workflows/slack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Slack
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
jobs:
on-failure:
runs-on: ubuntu-latest
if: {% raw %}${{ github.event.workflow_run.conclusion == 'failure' }}{% endraw %}
steps:
- name: Post to Slack
uses: slackapi/[email protected]
with:
channel-id: 'C4K6M7P5E'
slack-message: "A workflow run failed\n*Repo:* `{% raw %}${{ github.event.repository.full_name }}{% endraw %}` ({% raw %}${{ github.event.repository.html_url }}{% endraw %})\n*Workflow:* {% raw %}${{ github.event.workflow.name }}{% endraw %} ({% raw %}${{ github.event.workflow.html_url }}{% endraw %})\n*Branch:* `{% raw %}${{ github.event.workflow_run.head_branch }}{% endraw %}`\n*Commit:* `{% raw %}${{ github.event.workflow_run.head_commit.id }}{% endraw %}`\n*Run:* {% raw %}${{ github.event.workflow_run.html_url }}{% endraw %}\n*Conclusion:* {% raw %}${{ github.event.workflow_run.conclusion }}{% endraw %}"
env:
SLACK_BOT_TOKEN: {% raw %}${{ secrets.SLACK_BOT_TOKEN }}{% endraw %}
1 change: 1 addition & 0 deletions pyapp/{{ cookiecutter.slug }}/.github/workflows/slack.yml

0 comments on commit 0195ac0

Please sign in to comment.