ci: enable Go module caching#1
Conversation
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement. I have read the CLA and agree to its terms. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
|
Warning Review limit reached
More reviews will be available in 41 minutes and 29 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. 📝 WalkthroughWalkthroughThe CI workflow's ChangesCI Cache Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 28-29: The cache-dependency-path configuration in the GitHub
Actions workflow is currently set to only cache based on go.sum, which means
cache invalidation will not occur when go.mod changes. Update the
cache-dependency-path property to use multi-line YAML syntax that includes both
go.mod and go.sum by using the pipe operator (|) followed by both file names on
separate indented lines.
- Around line 28-29: The cache-dependency-path in the setup-go action is only
set to go.sum, which means changes to go.mod will not invalidate the cache,
potentially leading to stale dependencies. Update the cache-dependency-path
value to include both go.mod and go.sum files using a multi-line format
(separated by newlines or a glob pattern) to ensure the cache is properly
invalidated when either file changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| cache: true | ||
| cache-dependency-path: go.sum |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify that go.mod and go.sum files exist in the repository root
echo "Checking for go.mod and go.sum files..."
ls -la go.mod go.sum 2>/dev/null || echo "One or both files not found in repository root"
# Also check if there are any go.mod files in other directories
echo -e "\nSearching for go.mod files in the entire repository..."
find . -name "go.mod" -type f 2>/dev/null | head -20Repository: WanderingHumanid/auth-server
Length of output: 291
🌐 Web query:
actions/setup-go cache-dependency-path multiple files syntax go.mod go.sum
💡 Result:
The actions/setup-go action supports multiple dependency files for the cache-dependency-path input through both multi-line YAML syntax and glob patterns [1][2][3]. For scenarios involving multiple go.mod or go.sum files (such as in monorepos or multi-module repositories), you can use the following methods: Multi-line YAML Syntax You can specify multiple files by using a literal block scalar (the | character) in your workflow configuration [1][2]: - uses: actions/setup-go@v6 with: go-version: '1.25' cache-dependency-path: | subdir/go.sum tools/go.sum Glob Patterns The action also supports glob patterns to automatically include multiple files matching a specific structure [1][2][3]: - uses: actions/setup-go@v6 with: go-version: '1.25' cache-dependency-path: '/go.sum' You can also combine multiple types of files (such as dependency files and build configuration files like env.txt or source code files) using the same multi-line syntax if you need to invalidate the cache based on changes to non-dependency files [1]. Note that by default, the action uses go.mod in the root; setting cache-dependency-path allows you to override this to include specific or multiple files [4][5].
Citations:
- 1: https://github.com/actions/setup-go/blob/main/docs/advanced-usage.md
- 2: feat: improve support for multi-module repos actions/setup-go#371
- 3: actions/setup-go@56a61c9
- 4: https://github.com/actions/setup-go/
- 5: https://github.com/actions/setup-go/blob/main/README.md
Expand cache-dependency-path to include both go.mod and go.sum.
The current configuration overrides the action's default behavior, which includes go.mod. By specifying only go.sum, cache invalidation will not occur when go.mod changes (e.g., when dependencies are added or removed). Use multi-line YAML syntax to include both files:
cache-dependency-path: |
go.mod
go.sum🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/ci.yml around lines 28 - 29, The cache-dependency-path
configuration in the GitHub Actions workflow is currently set to only cache
based on go.sum, which means cache invalidation will not occur when go.mod
changes. Update the cache-dependency-path property to use multi-line YAML syntax
that includes both go.mod and go.sum by using the pipe operator (|) followed by
both file names on separate indented lines.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify that go.mod and go.sum files exist
echo "Checking for Go dependency files..."
if [ -f go.mod ]; then
echo "✓ go.mod found"
else
echo "✗ go.mod NOT found"
fi
if [ -f go.sum ]; then
echo "✓ go.sum found"
else
echo "✗ go.sum NOT found"
fiRepository: WanderingHumanid/auth-server
Length of output: 138
🌐 Web query:
GitHub Actions actions/setup-go cache-dependency-path go.mod go.sum documentation
💡 Result:
In GitHub Actions, the setup-go action uses the cache-dependency-path input to specify the dependency files that determine the cache key for Go modules and build outputs [1][2]. As of the v6.0.0 release (January 2026), the default behavior for caching was updated to use go.mod instead of go.sum as the primary dependency file for the cache key [3][4]. This change was implemented to more accurately track project dependencies and improve CI performance [5]. Key points regarding the use of cache-dependency-path: - Default Behavior: By default, the action automatically searches for go.mod in the repository root and uses its hash as part of the cache key [1][4]. - Using go.sum: If you specifically need or prefer to use go.sum for your cache key, you can configure this by setting the cache-dependency-path input to go.sum [1][6]. - Advanced Configurations: The input supports glob patterns, multi-line values, and paths to files in subdirectories, making it suitable for monorepos or multi-module repositories [7][6]. - Customization: Beyond dependency files like go.mod or go.sum, you can include other files in cache-dependency-path, such as those capturing environment variables (e.g., GOOS, GOARCH) or source files, to ensure cache invalidation when specific build settings or code change [7]. Example configuration for using go.sum: - uses: actions/setup-go@v6 with: cache: true cache-dependency-path: go.sum
Citations:
- 1: https://github.com/actions/setup-go?tab=readme-ov-file
- 2: https://github.com/actions/setup-go/blob/main/action.yml
- 3: Update default Go module caching to use go.mod actions/setup-go#705
- 4: actions/setup-go@a5f9b05
- 5: Caching should use go.mod, not go.sum actions/setup-go#478
- 6: https://github.com/actions/setup-go/blob/main/README.md
- 7: https://github.com/actions/setup-go/blob/main/docs/advanced-usage.md
Include both go.mod and go.sum in cache-dependency-path to ensure complete cache invalidation.
Setting only cache-dependency-path: go.sum means the cache key will not be invalidated when go.mod changes. This can result in stale dependencies in CI if packages are added or removed. Configure the action to include both files to properly track all dependency changes.
Recommended fix
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23' # Use stable
cache: true
- cache-dependency-path: go.sum
+ cache-dependency-path: |
+ go.mod
+ go.sum📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| cache: true | |
| cache-dependency-path: go.sum | |
| cache: true | |
| cache-dependency-path: | | |
| go.mod | |
| go.sum |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/ci.yml around lines 28 - 29, The cache-dependency-path in
the setup-go action is only set to go.sum, which means changes to go.mod will
not invalidate the cache, potentially leading to stale dependencies. Update the
cache-dependency-path value to include both go.mod and go.sum files using a
multi-line format (separated by newlines or a glob pattern) to ensure the cache
is properly invalidated when either file changes.
7217d1e to
06afef9
Compare
Checklist
I have read the CLA and agree to its terms.on this PR.Summary by CodeRabbit