Compare commits

...

2 Commits

Author SHA1 Message Date
Diego Ferreyra 16e7e31df2 Add Slack notification for new/reopened issues 2026-01-23 16:43:34 -03:00
Diego Ferreyra 2f40b95666 Add Slack notification for new/reopened issues 2026-01-23 15:46:57 -03:00
+51
View File
@@ -0,0 +1,51 @@
name: Notify Slack on Issues
permissions:
contents: read
on:
issues:
types: [opened, reopened] # New issues AND reopened issues
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send to Slack
env:
ACTION: ${{ github.event.action }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_USER: ${{ github.event.issue.user.login }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_ISSUES }}
run: |
if [ "$ACTION" = "opened" ]; then
EMOJI="🆕"
TEXT="New Issue"
else
EMOJI="🔄"
TEXT="Issue Reopened"
fi
# Use jq to safely construct JSON payload (handles special characters in title)
PAYLOAD=$(jq -n \
--arg emoji "$EMOJI" \
--arg text "$TEXT" \
--arg number "$ISSUE_NUMBER" \
--arg title "$ISSUE_TITLE" \
--arg url "$ISSUE_URL" \
--arg user "$ISSUE_USER" \
'{
text: "\($emoji) \($text): #\($number) \($title)",
blocks: [
{
type: "section",
text: {
type: "mrkdwn",
text: "\($emoji) *\($text)*\n<\($url)|#\($number): \($title)>\nBy: \($user)"
}
}
]
}')
curl --fail -X POST -H 'Content-type: application/json' \
--data "$PAYLOAD" \
"$SLACK_WEBHOOK_URL"