Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Dependabot: add github action to fix modules on PRs and add test to configuration #2573

Merged
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
34 changes: 28 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,49 @@ updates:
prefix: ":seedling:"
labels:
- "ok-to-test"

# Go
# Main Go module
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
## group all dependencies with a k8s.io prefix into a single PR where possible
## group all dependencies with a k8s.io prefix into a single PR.
groups:
kubernetes:
patterns: [ "k8s.io/*" ]
ignore:
# Ignore k8s and its transitives modules as they are upgraded manually
# together with controller-runtime.
# Ignore controller-runtime as its upgraded manually.
- dependency-name: "sigs.k8s.io/controller-runtime"
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
# Ignore k8s and its transitives modules as they are upgraded manually together with controller-runtime.
- dependency-name: "k8s.io/*"
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
- dependency-name: "sigs.k8s.io/cluster-api/test"
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
commit-message:
prefix: ":seedling:"
labels:
- "ok-to-test"

# Test Go module
- package-ecosystem: "gomod"
directory: "/test"
schedule:
interval: "weekly"
day: "tuesday"
## group all dependencies with a k8s.io prefix into a single PR.
groups:
kubernetes:
patterns: [ "k8s.io/*" ]
ignore:
# Ignore controller-runtime as its upgraded manually.
- dependency-name: "sigs.k8s.io/controller-runtime"
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
# Ignore k8s and its transitives modules as they are upgraded manually together with controller-runtime.
- dependency-name: "k8s.io/*"
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
- dependency-name: "sigs.k8s.io/cluster-api/test"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
commit-message:
prefix: ":seedling:"
labels:
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/pr-dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: PR dependabot code generation and go modules fix

# This action runs on other PRs opened by dependabot. It updates modules and generated code on PRs opened by dependabot.
on:
pull_request:
branches:
- dependabot/**
push:
branches:
- dependabot/**
workflow_dispatch:

permissions:
contents: write # Allow to update the PR.

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # tag=v5.0.0
with:
go-version: ${{ steps.vars.outputs.go_version }}
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # tag=v3.3.2
name: Restore go cache
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Update all modules
run: make generate-modules
- name: Update generated code
run: make generate
- uses: EndBug/add-and-commit@1bad3abcf0d6ec49a5857d124b0bfb52dc7bb081 # tag=v9.1.3
name: Commit changes
with:
author_name: dependabot[bot]
author_email: 49699333+dependabot[bot]@users.noreply.github.com
default_author: github_actor
message: 'Update generated code'