@@ -24,31 +24,80 @@ 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
+ 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
+
52
101
cla :
53
102
runs-on : ubuntu-latest
54
103
permissions :
0 commit comments