Skip to content

Commit

Permalink
Dependabot script: Legg på krav om at endringen bygges og testes, og …
Browse files Browse the repository at this point in the history
…at vi får slack-melding om noe feiler
  • Loading branch information
KarlEvaldNav committed Dec 17, 2024
1 parent f417bca commit 0a56041
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,25 @@ jobs:
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run tests
run: ./gradlew test
- name: Build and run tests
run: ./gradlew build
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
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}}
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_VARSEL_WEBHOOK_URL }}

0 comments on commit 0a56041

Please sign in to comment.