Skip to content

New issue test

New issue test #6

name: Issue Activity
on:
issues:
types: [opened]
env:
SLACK_NOTIFICATION_CHANNEL: ${{ secrets.SLACK_APP_NOTIFICATION_CHANNEL }}
jobs:
slack:
name: Slack Notifications
runs-on: ubuntu-latest
steps:
- name: Send issue to Slack
shell: pwsh
run: |
# Format issue as a quote
$issueBody = @"
${{ github.event.issue.body }}
"@ -replace "`n" "`n>"
$messageBody = @"
A <${{ github.event.issue.html_url }}|new issue> has been opened by _${{ github.event.issue.user.login }}_ in *${{ github.repository }}*
> *#${{ github.event.issue.number }} ${{ github.event.issue.title }}*
>
> $($issueBody)
"@
$headers = @{
"Authorization" = "Bearer ${{ secrets.SLACK_APP_TOKEN }}"
}
$body = @{
"text" = $messageBody
"channel" = $env:SLACK_NOTIFICATION_CHANNEL
"mrkdwn" = $true
"parse" = "none"
}
# Post the message
Invoke-WebRequest -Uri "https://slack.com/api/chat.postMessage" -Method POST -Headers $headers -Body $body