-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oppdater dependabot-auto-merge.yml til å være nais sin anbefalte versjon
Co-authored-by: hbleness <henrietta.eide.bleness@nav.no>
- Loading branch information
1 parent
f04e341
commit da31acf
Showing
1 changed file
with
16 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,23 @@ | ||
name: Auto Merge dependabot | ||
on: pull_request_target | ||
name: Dependabot auto-merge | ||
on: pull_request | ||
|
||
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@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 21 | ||
|
||
- uses: gradle/gradle-build-action@v3 | ||
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 }} | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
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 | ||
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} | ||
steps: | ||
- run: gh pr merge --auto --rebase "$PR_URL" | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v1 | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Auto-merge changes from Dependabot | ||
if: steps.metadata.outputs.update-type != 'version-update:semver-major' || steps.metadata.outputs.package-ecosystem == 'github_actions' | ||
run: gh pr merge --auto --squash "$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 }} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |