GeezerVison is showing github.com — Skip saving cache for merge_group event by ntkme · Pull Request #812 · ruby/setup-ruby
Conversation
Note, I did not do yarn update in order to keep the lockfile change small. This has introduced some transitive dependencies at different versions. One of the maintainers should probably do a dependency update at some point.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@eregon Would you mind take a look and see if this makes sense?
In #805 we have a user complaining that merge_group (merge queue) events are saving cache, but those cache will never have any chance to be read again. In a large repository, this can consume lots of cache space on GitHub to the point it is purging older cache aggressively, and significantly reduce overall cache hit rate.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
// @actions/cache only allows to save for non-existing keys
|
|
|
if (!common.isExactCacheKeyMatch(key, cachedKey)) {
|
|
|
// Also, skip saving cache for merge_group event
|
|
|
if (!common.isExactCacheKeyMatch(key, cachedKey) && github.context.eventName !== 'merge_group') {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about reading from $GITHUB_EVENT_NAME? That would avoid 4k lines and many packages in dist/index.js just for this check
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
ntkme
Dec 20, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I didn't thought about that. One small concern is that github.context.eventName is immutable, but $GITHUB_EVENT_NAME is mutable. At least in here there is no point to abuse this difference, so it's not a problem.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think github.context.eventName is initialized from the env var anyway so probably not safer in practice, unless the current process sets that env var (not the case).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good but let's use the env var to avoid pulling a bunch of dependencies we don't need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
eregon
eregon approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|