name: Dependabot PR Notification to Slack
on:
pull_request:
types:
- opened
branches:
- 'dependabot/**'
pull_request_target:
branches:
- 'dependabot/**'
workflow_dispatch:
jobs:
Slack-PR-Notification:
name: Slack PR Notification
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: slackapi/[email protected]
id: slack
with:
payload: |
{
"text": "New ${{ github.repository}} Dependabot PR Available for Review: ${{ github.event.pull_request.html_url}}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- uses: slackapi/[email protected]
if: ${{ github.event.pull_request.merged }}
with:
update-ts: ${{ steps.slack.outputs.ts }}
payload: |
{
"text": "PR has been merged. Thank you!",
"attachments": [
{
"pretext": "Merge complete",
"color": "28a745",
"fields": [
{
"title": "Status",
"short": true,
"value": "Completed"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
我尝试了一些方法,包括 if: ${{ github.actor == 'dependabot[bot]' }}
,但许多堆栈溢出帖子和其他文档/文章要么使用过时/旧的操作包,要么没有完成我想要做的事情。非常感谢任何帮助 - 谢谢!