Created
April 13, 2023 19:36
-
-
Save brenogcota/31a7f179908aaaad5a13e5b617257d93 to your computer and use it in GitHub Desktop.
This file contains 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
function pr_notify() { | |
url=$(echo $(gh pr view | sed '10!d' | sed 's/.*://')) | |
title=$(echo $(gh pr view | sed '1!d' | sed 's/.*://')) | |
state=$(echo $(gh pr view | sed '2!d' | sed 's/.*://')) | |
author=$(echo $(gh pr view | sed '3!d' | sed 's/.*://')) | |
data=$(echo '{ | |
"cards": [ | |
{ | |
"header": { | |
"title": "🤖 Code Review", | |
}, | |
"sections": [ | |
{ | |
"widgets": [ | |
{ | |
"keyValue": { | |
"topLabel": "message", | |
"content": "'$title'" | |
}, | |
}, | |
{ | |
"keyValue": { | |
"topLabel": "author", | |
"content": "'$author'" | |
}, | |
}, | |
{ | |
"keyValue": { | |
"topLabel": "url", | |
"content": "https:'$url'" | |
}, | |
}, | |
{ | |
"keyValue": { | |
"topLabel": "status", | |
"content": "'$state'" | |
}, | |
}, | |
{ | |
"buttons": [ | |
{ | |
"textButton": { | |
"text": "OPEN PR", | |
"onClick": { | |
"openLink": { | |
"url": "https:'$url'" | |
} | |
} | |
} | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
}') | |
curl --location --request POST '<your-webhook-url>' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw $data | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment