Skip to content

Commit 7d484a3

Browse files
fix(deps): bump the go-minor-patch group across 1 directory with 2 updates (#157)
* fix(deps): bump the go-minor-patch group across 1 directory with 2 updates Bumps the go-minor-patch group with 2 updates in the / directory: [github.com/speakeasy-api/jsonpath](https://github.com/speakeasy-api/jsonpath) and [golang.org/x/text](https://github.com/golang/text). Updates `github.com/speakeasy-api/jsonpath` from 0.6.2 to 0.6.3 - [Release notes](https://github.com/speakeasy-api/jsonpath/releases) - [Commits](speakeasy-api/jsonpath@v0.6.2...v0.6.3) Updates `golang.org/x/text` from 0.33.0 to 0.34.0 - [Release notes](https://github.com/golang/text/releases) - [Commits](golang/text@v0.33.0...v0.34.0) --- updated-dependencies: - dependency-name: github.com/speakeasy-api/jsonpath dependency-version: 0.6.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-minor-patch - dependency-name: golang.org/x/text dependency-version: 0.34.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-minor-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore: rename mise-tasks to .mise-tasks, tidy all go modules, add dependabot auto-tidy workflow --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tristan Cartledge <108070248+TristanSpeakEasy@users.noreply.github.com> Co-authored-by: Tristan Cartledge <tristan@speakeasyapi.dev>
1 parent cb9240e commit 7d484a3

File tree

27 files changed

+128
-55
lines changed

27 files changed

+128
-55
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Dependabot Go Mod Tidy
2+
3+
on:
4+
pull_request_target:
5+
branches: [main]
6+
7+
jobs:
8+
tidy:
9+
name: Go Mod Tidy
10+
runs-on: ubuntu-latest
11+
if: github.actor == 'dependabot[bot]'
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- uses: actions/checkout@v6
17+
with:
18+
ref: ${{ github.head_ref }}
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
submodules: recursive
21+
22+
- name: Setup Go with caching
23+
uses: actions/setup-go@v6
24+
with:
25+
go-version-file: go.work
26+
cache: true
27+
28+
- name: Install mise
29+
uses: jdx/mise-action@v3
30+
with:
31+
experimental: true
32+
33+
- name: Run go mod tidy for all modules
34+
run: mise run mod-tidy
35+
36+
- name: Commit changes if any
37+
run: |
38+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
git config --local user.name "github-actions[bot]"
40+
git add -A
41+
if git diff --staged --quiet; then
42+
echo "No changes to commit"
43+
else
44+
git commit -m "chore: go mod tidy"
45+
git push
46+
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.mise-tasks/mod-check

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
echo "🔍 Checking if go.mod and go.sum are tidy..."
5+
6+
FAILED=0
7+
8+
while IFS= read -r gomod_file; do
9+
dir=$(dirname "$gomod_file")
10+
display="${dir#./}"
11+
[ "$display" = "." ] && display="root"
12+
echo " Checking $display..."
13+
14+
# Backup go.mod and go.sum
15+
cp "$gomod_file" "$gomod_file.bak"
16+
[ -f "$dir/go.sum" ] && cp "$dir/go.sum" "$dir/go.sum.bak" || true
17+
18+
# Run go mod tidy
19+
(cd "$dir" && go mod tidy)
20+
21+
# Check if files changed
22+
if ! cmp -s "$gomod_file" "$gomod_file.bak" || \
23+
{ [ -f "$dir/go.sum.bak" ] && ! cmp -s "$dir/go.sum" "$dir/go.sum.bak"; } || \
24+
{ [ -f "$dir/go.sum" ] && ! [ -f "$dir/go.sum.bak" ]; }; then
25+
echo "$display needs tidying!"
26+
FAILED=1
27+
fi
28+
29+
# Restore original files
30+
mv "$gomod_file.bak" "$gomod_file"
31+
if [ -f "$dir/go.sum.bak" ]; then
32+
mv "$dir/go.sum.bak" "$dir/go.sum"
33+
elif [ -f "$dir/go.sum" ]; then
34+
# go.sum was created by tidy but didn't exist before — remove it
35+
rm -f "$dir/go.sum"
36+
fi
37+
done < <(find . -name "go.mod" -not -path "*/vendor/*" | sort)
38+
39+
if [ "$FAILED" -eq 1 ]; then
40+
echo ""
41+
echo "❌ go.mod or go.sum is not tidy!"
42+
echo "Please run 'mise run mod-tidy' to fix module dependencies."
43+
exit 1
44+
fi
45+
46+
echo "✅ go.mod and go.sum are tidy!"

.mise-tasks/mod-tidy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
echo "📦 Tidying Go modules..."
5+
6+
while IFS= read -r gomod_file; do
7+
dir=$(dirname "$gomod_file")
8+
display="${dir#./}"
9+
[ "$display" = "." ] && display="root"
10+
echo "$display"
11+
(cd "$dir" && go mod tidy)
12+
done < <(find . -name "go.mod" -not -path "*/vendor/*" | sort)
13+
14+
echo "✅ All Go modules tidied!"

0 commit comments

Comments
 (0)