Skip to content

Commit 867ebd6

Browse files
committed
Use Dependabot for updading go.mod and GH workflows
Maintaining our go.mod (we have 3 of them) up to date is a bit of work and other cluster-api providers use dependabot to take care of it. I took a look at the vsphere and azure providers and pretty much copy pasted (with adjustments).
1 parent 5b66f35 commit 867ebd6

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/dependabot.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Please see the documentation for all configuration options: https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
3+
version: 2
4+
updates:
5+
6+
# github-actions
7+
- directory: "/"
8+
package-ecosystem: "github-actions"
9+
open-pull-requests-limit: 5
10+
schedule:
11+
interval: "weekly"
12+
day: "monday"
13+
groups:
14+
all-github-actions:
15+
patterns: [ "*" ]
16+
commit-message:
17+
prefix: ":seedling: chore(deps): bump"
18+
include: scope
19+
labels:
20+
- "area/dependency"
21+
- "ok-to-test"
22+
23+
# Go directories
24+
- directories:
25+
- "/"
26+
- "/hack/tools"
27+
- "/orc"
28+
package-ecosystem: "gomod"
29+
open-pull-requests-limit: 5
30+
schedule:
31+
interval: "weekly"
32+
day: "monday"
33+
## group all dependencies with a k8s.io prefix into a single PR.
34+
groups:
35+
all-go-mod-patch-and-minor:
36+
patterns: [ "*" ]
37+
update-types: [ "patch", "minor" ]
38+
commit-message:
39+
prefix: ":seedling: chore(deps): bump"
40+
include: scope
41+
ignore:
42+
# Ignore controller-runtime as its upgraded manually.
43+
- dependency-name: "sigs.k8s.io/controller-runtime"
44+
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
45+
# Ignore k8s and its transitives modules as they are upgraded manually together with controller-runtime.
46+
- dependency-name: "k8s.io/*"
47+
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
48+
- dependency-name: "github.com/prometheus/*"
49+
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
50+
- dependency-name: "sigs.k8s.io/cluster-api-provider-openstack"
51+
labels:
52+
- "area/dependency"
53+
- "ok-to-test"

.github/workflows/pr-dependabot.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: PR dependabot code generation and go modules fix
2+
3+
# This action runs on other PRs opened by dependabot. It updates modules and generated code on PRs opened by dependabot.
4+
on:
5+
pull_request:
6+
branches:
7+
- dependabot/**
8+
push:
9+
branches:
10+
- dependabot/**
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: write # Allow to update the PR.
15+
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check out code into the Go module directory
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2
23+
- name: Calculate go version
24+
id: vars
25+
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
26+
- name: Set up Go
27+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # tag=v5.1.0
28+
with:
29+
go-version: ${{ steps.vars.outputs.go_version }}
30+
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # tag=v4.1.2
31+
name: Restore go cache
32+
with:
33+
path: |
34+
~/.cache/go-build
35+
~/go/pkg/mod
36+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
37+
restore-keys: |
38+
${{ runner.os }}-go-
39+
- name: Update all modules
40+
run: make modules
41+
- name: Update generated code
42+
run: make generate
43+
- uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # tag=v9.1.4
44+
name: Commit changes
45+
with:
46+
author_name: dependabot[bot]
47+
author_email: 49699333+dependabot[bot]@users.noreply.github.com
48+
default_author: github_actor
49+
message: 'Update generated code'

0 commit comments

Comments
 (0)