Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
version: 2
updates:
- package-ecosystem: 'gomod'
- package-ecosystem: gomod
directory: '/'
labels:
- "area/dependency"
- "ok-to-test"
allow:
- dependency-name: "github.com/openshift/osd-network-verifier"
- dependency-name: "github.com/openshift/backplane-cli"
schedule:
interval: 'daily'
interval: 'weekly'
open-pull-requests-limit: 10
50 changes: 50 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Dependabot Auto-Merge

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: |
github.event.pull_request.user.login == 'dependabot[bot]' &&
github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Enable auto-merge for patch and minor updates
if: |
steps.metadata.outputs.update-type == 'version-update:semver-patch' ||
steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Comment on major version updates
if: |
github.event.action == 'opened' &&
steps.metadata.outputs.update-type == 'version-update:semver-major'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEPENDENCY_NAMES: ${{ steps.metadata.outputs.dependency-names }}
PREVIOUS_VERSION: ${{ steps.metadata.outputs.previous-version }}
NEW_VERSION: ${{ steps.metadata.outputs.new-version }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
"/repos/${REPOSITORY}/issues/${PR_NUMBER}/comments" \
-f body="Major version update detected for ${DEPENDENCY_NAMES} (${PREVIOUS_VERSION} -> ${NEW_VERSION}). Auto-merge is disabled; manual review required."