If commits are not present in a push event, build head_commit

When a branch is pushed with a HEAD commit, which already exists on
github, a push event will not contain commits info, so we nead to use
head_commit, in order to get commit info.