@@ -24,31 +24,74 @@ concurrency: pr-${{ github.ref }}
24
24
25
25
jobs :
26
26
# Dependabot is annoying, but this makes it a bit less so.
27
- dependabot :
27
+ dependabot-automerge :
28
28
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'
30
30
permissions :
31
31
pull-requests : write
32
- steps :
32
+ steps :
33
33
- name : Dependabot metadata
34
34
id : metadata
35
- uses : dependabot/fetch-metadata@4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d # v2.2.0
35
+ uses : dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
36
36
with :
37
37
github-token : " ${{ secrets.GITHUB_TOKEN }}"
38
-
38
+
39
39
- name : Approve the PR
40
40
run : gh pr review --approve "$PR_URL"
41
41
env :
42
42
PR_URL : ${{github.event.pull_request.html_url}}
43
43
GH_TOKEN : ${{secrets.GITHUB_TOKEN}}
44
-
44
+
45
45
- name : Enable auto-merge for Dependabot PRs
46
46
if : steps.metadata.outputs.update-type == 'version-update:semver-patch'
47
47
run : gh pr merge --auto --merge "$PR_URL"
48
48
env :
49
49
PR_URL : ${{github.event.pull_request.html_url}}
50
50
GH_TOKEN : ${{secrets.GITHUB_TOKEN}}
51
51
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
+ run : |
59
+ curl -X POST -H 'Content-type: application/json' \
60
+ --data '{
61
+ "blocks": [
62
+ {
63
+ "type": "header",
64
+ "text": {
65
+ "type": "plain_text",
66
+ "text": ":pr-merged: Dependabot PR auto merged",
67
+ "emoji": true
68
+ }
69
+ },
70
+ {
71
+ "type": "section",
72
+ "fields": [
73
+ {
74
+ "type": "mrkdwn",
75
+ "text": "${{ github.event.pull_request.title }}"
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "type": "actions",
81
+ "elements": [
82
+ {
83
+ "type": "button",
84
+ "text": {
85
+ "type": "plain_text",
86
+ "text": "View PR"
87
+ },
88
+ "url": "${{ github.event.pull_request.html_url }}"
89
+ }
90
+ ]
91
+ }
92
+ ]
93
+ }' ${{ secrets.DEPENDABOT_PRS_SLACK_WEBHOOK }}
94
+
52
95
cla :
53
96
runs-on : ubuntu-latest
54
97
permissions :
0 commit comments