Skip to content

Commit eafc368

Browse files
authored
Merge pull request #54 from joonas/chore/dependabot-pr-go-mod
chore(ci): Add workflow to run go mod tidy on dependabot PRs
2 parents 47aa778 + 7cb4533 commit eafc368

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Dependabot go mod tidy
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/go.mod'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
dependabot:
13+
runs-on: ubuntu-latest
14+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'wasmCloud/go' }}
15+
permissions:
16+
contents: write
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
ref: ${{ github.head_ref }}
21+
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
22+
with:
23+
go-version: 'stable'
24+
- name: Go mod tidy
25+
shell: bash
26+
run: |
27+
git config user.name "github-actions[bot]"
28+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
29+
30+
for mod_dir in $(find . -type f -name 'go.mod' | xargs dirname); do
31+
pushd "$mod_dir"
32+
go mod tidy
33+
popd
34+
done
35+
36+
git add $(git ls-files -m)
37+
git commit -m "chore: go mod tidy" --signoff
38+
git push

0 commit comments

Comments
 (0)