Drone

Memoization of starlark converters leads to missing events

I use the drone-starlark converter.

When I open a pull request in my Github repository I should get two events: pull_request and push, right? But really in my starlark script, I get only push event. I think that happens by the memoization that drone does when sees the first event push.

Moreover, when I push the same commit to another branch, I get no events!

Could you help me?

Update: I’ve commented these lines in memoize.go file:

and now it works as expected: I’ve recieved in my starlark script two events: push and pull_request!

When I added event type (req.Build.Event) to the cache key like:

// cache key pattern used in the cache, comprised of the
// repository slug and commit sha and event type.
const keyf = "%d/%s/%s"

...

key := fmt.Sprintf(keyf, req.Repo.ID, req.Build.After, req.Build.Event)

It is also works good!

EDIT: I can make a PR, if the above solution is OK.