Skip to content

Commit

Permalink
wip - composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Shandling committed Dec 24, 2024
1 parent e655e51 commit 5756b6c
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 27 deletions.
36 changes: 36 additions & 0 deletions .github/actions/slack-error-notification/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Slack notification on error
description: If the job fails, send a summary of errors to the Slack #help-engineering channel
# Schema: https://json.schemastore.org/github-action.json

# This action expects the following env vars to be set:
# ?

# inputs:
runs:
using: "composite"
steps:
- name: Slack Notification
# if: failure()
shell: bash
working-directory: "./"
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
with:
payload: |
{
"text": "${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<Jacobs GH action testing - disregard this notification> ${{ job.name }} - result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}"
}
}
]
}
env:
JOB_STATUS: ${{ job.status }}
EVENT_URL: ${{ github.event.pull_request.html_url || github.event.head.html_url }}
RUN_URL: https://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_G_HELP_ENGINEERING_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
57 changes: 30 additions & 27 deletions .github/workflows/jacob-experiment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,34 @@ jobs:
steps:
- name: Always fail
run: exit 1
- name: Slack notification
- name: Notify errors in slack
if: failure()
# confirm:
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
# confirm:
with:
payload: |
{
"text": "${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Happy Holidays! Jacob's always fails test result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}"
}
}
]
}
env:
# confirm:
JOB_STATUS: ${{ job.status }}
# confirm:
EVENT_URL: ${{ github.event.pull_request.html_url || github.event.head.html_url }}
# confirm:
RUN_URL: https://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_G_HELP_ENGINEERING_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
uses: ./.github/actions/slack-error-notification
# - name: Slack notification
# if: failure()
# # confirm:
# uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
# # confirm:
# with:
# payload: |
# {
# "text": "${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}",
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "Happy Holidays! Jacob's always fails test result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}"
# }
# }
# ]
# }
# env:
# # confirm:
# JOB_STATUS: ${{ job.status }}
# # confirm:
# EVENT_URL: ${{ github.event.pull_request.html_url || github.event.head.html_url }}
# # confirm:
# RUN_URL: https://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_G_HELP_ENGINEERING_WEBHOOK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

0 comments on commit 5756b6c

Please sign in to comment.