Hey ๐
I'm currently writing a module to interact with GitHub and facing some issues with the caching.
Basically I'd like to check if a PR is merged or not. So I've written a function that looks like this:
func (m *Github) IsMerged(ctx context.Context, owner, repo string, number int) (bool, error) {
client := github.NewClient(nil).WithAuthToken(m.Token)
ok, _, err := client.PullRequests.IsMerged(ctx, owner, repo, number)
return ok, err
}
I can then call the function from another module like so: dag.Github().IsMerged("dagger", "dagger", 1)
This works very well.
However, the caching is causing issues when I try to implement logic like waiting until the PR is merged.
In my consumer module, if I call the IsMerged function multiple times in a row then I always get a cache hit to the first call.
This makes logic such as while not IsMerged; sleep 5 and means that I cannot trust the output of IsMerged since it might be cached from a long time ago.
Is there a way I can flag a function so that it is never cached?
Otherwise I think I'd have to add a cachebuster parameter to make each call signature unique?
Thanks for your help!