Skip to content

Commit 84081e9

Browse files
authored
chore: notify on auto merged dependabot PRs (#16234)
1 parent a6e054a commit 84081e9

File tree

1 file changed

+55
-6
lines changed

1 file changed

+55
-6
lines changed

.github/workflows/contrib.yaml

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,80 @@ concurrency: pr-${{ github.ref }}
2424

2525
jobs:
2626
# Dependabot is annoying, but this makes it a bit less so.
27-
dependabot:
27+
dependabot-automerge:
2828
runs-on: ubuntu-latest
29-
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'coder/coder'
29+
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'coder/coder'
3030
permissions:
3131
pull-requests: write
32-
steps:
32+
steps:
3333
- name: Dependabot metadata
3434
id: metadata
35-
uses: dependabot/fetch-metadata@4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d # v2.2.0
35+
uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
3636
with:
3737
github-token: "${{ secrets.GITHUB_TOKEN }}"
38-
38+
3939
- name: Approve the PR
4040
run: gh pr review --approve "$PR_URL"
4141
env:
4242
PR_URL: ${{github.event.pull_request.html_url}}
4343
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
44-
44+
4545
- name: Enable auto-merge for Dependabot PRs
4646
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
4747
run: gh pr merge --auto --merge "$PR_URL"
4848
env:
4949
PR_URL: ${{github.event.pull_request.html_url}}
5050
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
5151

52+
dependabot-automerge-notify:
53+
# Send a slack notification when a dependabot PR is merged.
54+
runs-on: ubuntu-latest
55+
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'coder/coder' && github.event.pull_request.merged
56+
steps:
57+
- name: Send Slack notification
58+
env:
59+
PR_URL: ${{github.event.pull_request.html_url}}
60+
PR_TITLE: ${{github.event.pull_request.title}}
61+
PR_NUMBER: ${{github.event.pull_request.number}}
62+
run: |
63+
curl -X POST -H 'Content-type: application/json' \
64+
--data '{
65+
"username": "dependabot",
66+
"icon_url": "https://avatars.githubusercontent.com/u/27347476",
67+
"blocks": [
68+
{
69+
"type": "header",
70+
"text": {
71+
"type": "plain_text",
72+
"text": ":pr-merged: Auto merged Dependabot PR #${{ env.PR_NUMBER }}",
73+
"emoji": true
74+
}
75+
},
76+
{
77+
"type": "section",
78+
"fields": [
79+
{
80+
"type": "mrkdwn",
81+
"text": "${{ env.PR_TITLE }}"
82+
}
83+
]
84+
},
85+
{
86+
"type": "actions",
87+
"elements": [
88+
{
89+
"type": "button",
90+
"text": {
91+
"type": "plain_text",
92+
"text": "View PR"
93+
},
94+
"url": "${{ env.PR_URL }}"
95+
}
96+
]
97+
}
98+
]
99+
}' ${{ secrets.DEPENDABOT_PRS_SLACK_WEBHOOK }}
100+
52101
cla:
53102
runs-on: ubuntu-latest
54103
permissions:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy