Skip to content

Instantly share code, notes, and snippets.

@key
Created February 4, 2025 07:59
Show Gist options
  • Save key/5ec158028fa48bf482acb25c7d553a1d to your computer and use it in GitHub Desktop.
Save key/5ec158028fa48bf482acb25c7d553a1d to your computer and use it in GitHub Desktop.
Example workflow for Slack GitHub Action
# .github/workflows/tmp-slack-github-action.yml
name: "[tmp] Slack GitHub Actions Debug"
on:
workflow_dispatch:
jobs:
send-to-slack:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: read
steps:
- name: Send GitHub Action data to a Slack workflow
uses: slackapi/[email protected]
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"text": "plain text *GitHub Action build result*: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "blocks section :github: *bold* _italic_ ~strike~ GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment