Skip to content

Commit 7c0bc58

Browse files
committed
workflows: Auto go mod tidy dependabot PRs
Do to our repo structure of go modules, we frequently hit issues that dependabout bumps versions, but other modules that reference the changes module don't get updated, so we have error with go mod and sum not being tidied. Attempt to create a workflow that will automatically do this change, so that we don't need to do it manually anymore. Signed-off-by: stevenhorsman <[email protected]>
1 parent c5ea6ca commit 7c0bc58

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Automatically run go mod tidy on dependabot PRs
2+
on:
3+
pull_request:
4+
branches: [ main ]
5+
6+
permissions:
7+
contents: write # We need permissions to push new content to the PR
8+
9+
jobs:
10+
tidy-dependabot-pr:
11+
runs-on: ubuntu-latest
12+
if: github.event.pull_request.user.login == 'dependabot[bot]'
13+
14+
steps:
15+
- name: Checkout the pull request code
16+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
17+
with:
18+
persist-credentials: false
19+
20+
- name: Run go mod tidy
21+
run: |
22+
./hack/go-tidy.sh
23+
24+
- name: Commit and Push Changes
25+
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 #v7.1.0
26+
with:
27+
commit_message: "chore: Auto-run go mod tidy after Dependabot update"

0 commit comments

Comments
 (0)