Skip to content

Commit

Permalink
Update the status msg template
Browse files Browse the repository at this point in the history
  • Loading branch information
kaleocheng committed Feb 24, 2023
1 parent ba2075a commit dfd2c2d
Showing 1 changed file with 181 additions and 32 deletions.
213 changes: 181 additions & 32 deletions .github/workflows/slack_status_notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,44 @@ jobs:
channel-id: ${{ inputs.slack_channel_id }}
payload: |
{
"text": "${{ inputs.msg }}",
"attachments": [
{
"color": "dbab09",
"fields": [
"blocks": [
{
"title": "Status",
"short": true,
"value": "In Progress"
"type": "header",
"text": {
"type": "plain_text",
"text": "In progress"
}
},
{
"title": "Run",
"short": true,
"value": "${{ env.RUN_URL }}"
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ inputs.msg }}"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "status update by ${{ github.actor }} from ${{ github.repository }}."
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "<${{ env.RUN_URL }}|check logs> on Github Action"
}
]
}
]
}
Expand All @@ -66,20 +90,44 @@ jobs:
channel-id: ${{ inputs.slack_channel_id }}
payload: |
{
"text": "${{ inputs.msg }}",
"attachments": [
{
"color": "28a745",
"fields": [
"blocks": [
{
"title": "Status",
"short": true,
"value": "Success"
"type": "header",
"text": {
"type": "plain_text",
"text": "Success"
}
},
{
"title": "Run",
"short": true,
"value": "${{ env.RUN_URL }}"
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ inputs.msg }}"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "status update by ${{ github.actor }} from ${{ github.repository }}."
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "<${{ env.RUN_URL }}|check logs> on Github Action"
}
]
}
]
}
Expand All @@ -95,20 +143,44 @@ jobs:
channel-id: ${{ inputs.slack_channel_id }}
payload: |
{
"text": "${{ inputs.msg }}",
"attachments": [
{
"color": "bc0d24",
"fields": [
"blocks": [
{
"title": "Status",
"short": true,
"value": "Failure"
"type": "header",
"text": {
"type": "plain_text",
"text": "Failure"
}
},
{
"title": "Run",
"short": true,
"value": "${{ env.RUN_URL }}"
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ inputs.msg }}"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "status update by ${{ github.actor }} from ${{ github.repository }}."
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "<${{ env.RUN_URL }}|check logs> on Github Action"
}
]
}
]
}
Expand All @@ -124,20 +196,97 @@ jobs:
channel-id: ${{ inputs.slack_channel_id }}
payload: |
{
"text": "${{ inputs.msg }}",
"attachments": [
{
"color": "808080",
"fields": [
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Cancelled"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ inputs.msg }}"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "status update by ${{ github.actor }} from ${{ github.repository }}."
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "<${{ env.RUN_URL }}|check logs> on Github Action"
}
]
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Post skipped msg to Slack
if: inputs.status == 'skipped'
uses: slackapi/[email protected]
with:
channel-id: ${{ inputs.slack_channel_id }}
payload: |
{
"attachments": [
{
"color": "808080",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Skipped"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ inputs.msg }}"
}
},
{
"type": "divider"
},
{
"title": "Status",
"short": true,
"value": "Cancelled"
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "status update by ${{ github.actor }} from ${{ github.repository }}."
}
]
},
{
"title": "Run",
"short": true,
"value": "${{ env.RUN_URL }}"
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "<${{ env.RUN_URL }}|check logs> on Github Action"
}
]
}
]
}
Expand Down

0 comments on commit dfd2c2d

Please sign in to comment.