This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
generated from navikt/tiltakspenger-template
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (53 loc) · 2.53 KB
/
dependabot-auto-merge.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
name: Auto Merge dependabot
on: pull_request_target
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
packages: write
if: github.actor == 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 21
- uses: gradle/gradle-build-action@v2
with:
arguments: build --info
- name: Notify Slack in case of build failure
if: failure()
run: |
curl -X POST --data-urlencode "payload={ \"attachments\": [{ \"pretext\": \"[${{ github.event.repository.name }}] Build failed :cry:\", \"color\": \"danger\", \"fields\": [ { \"title\": \"Author\", \"value\": \"$AUTHOR\", \"short\": false }, { \"title\": \"Branch\", \"value\": \"$BRANCH\", \"short\": false }, { \"title\": \"Commit\", \"value\": \"<https://github.com/${{ github.repository }}/commit/$PR_SHA|$PR_SHA>\", \"short\": false } ] }] }" $WEBHOOK_URL
env:
PR_SHA: ${{ github.event.pull_request.head.sha }}
BRANCH: ${{ github.head_ref }}
AUTHOR: ${{ github.actor }}
WEBHOOK_URL: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}
dependabot:
name: Merge
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
# Only allow dependabot from this repo and not via forks
if: github.actor == 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
steps:
- run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Notify Slack in case of merge failure
if: failure()
run: |
curl -X POST --data-urlencode "payload={ \"attachments\": [{ \"pretext\": \"[${{ github.event.repository.name }}] Merge failed :cry:\", \"color\": \"danger\", \"fields\": [ { \"title\": \"Author\", \"value\": \"$AUTHOR\", \"short\": false }, { \"title\": \"Branch\", \"value\": \"$BRANCH\", \"short\": false }, { \"title\": \"Commit\", \"value\": \"<https://github.com/${{ github.repository }}/commit/$PR_SHA|$PR_SHA>\", \"short\": false } ] }] }" $WEBHOOK_URL
env:
PR_SHA: ${{ github.event.pull_request.head.sha }}
BRANCH: ${{ github.head_ref }}
AUTHOR: ${{ github.actor }}
WEBHOOK_URL: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}