-
-
Notifications
You must be signed in to change notification settings - Fork 84
63 lines (63 loc) · 2.5 KB
/
dependabot-new-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Dependabot New PR
on:
pull_request:
types:
- opened
- reopened
jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- uses: actions/checkout@v4
- name: read maintainers.json
id: read-maintainers
# reads maintainers array and map them to their slack userIds "mentions" (see slack api https://api.slack.com/reference/surfaces/formatting#mentioning-users)
run: |
# shellcheck disable=SC2002
echo "maintainers=$(cat maintainers.json | jq '.[] | to_entries | .[].value' | jq --slurp -r '. | join(" ")')" >> "$GITHUB_OUTPUT"
- name: 'Post PR to #dev-pr'
if: always() # continue even if read-maintainers failed for some reason
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
MAINTAINERS: ${{ steps.read-maintainers.outputs.maintainers }}
with:
channel-id: C0399MY1YKW # dev-pr channel
payload: |
{
"attachments": [
{
"mrkdwn_in": ["text"],
"color": "#3679a6",
"author_name": "Dependabot 🤖",
"author_icon": "https://manage.cove.is/imgs/favicon.png",
"title": "${{ github.event.pull_request.title }}",
"title_link": "${{ github.event.pull_request.html_url }}",
"fields":
[
{
"title": "repository",
"value": "${{ github.event.pull_request.head.repo.name }} ",
"short": false
},
{
"title": "maintainers",
"value": "${{ env.MAINTAINERS || 'no one' }}",
"short": true
}
],
"thumb_url": "https://manage.cove.is/imgs/favicon.png",
}
]
}
#############################################
notify-all:
#############################################
uses: livelyhood/cove-workflows/.github/workflows/notify.yml@main
needs:
- dependabot
if: ${{ always() && contains(needs.*.result, 'failure') }}
secrets: inherit
with:
failure: true