google-cloud-build-slack
google-cloud-build-slack copied to clipboard
Add github commit author retrieval method for github app triggers
Hello,
Seeing that github app triggers are in the works, the current retrieval method for the github owner does not work since there is no cloudSourceRepo to "fetch" githubOwner, githubRepo for these kinds of triggers, as they only exist for the Mirrored Repo triggers.
There is actually a much cleaner way via the github events config of Github App triggers.
We should add an If statement to check if that object exists (aka if it is a Github App trigger) and retrieve github repo/owner info from there, and if not then fallback to the current method.
Does that make sense?
https://github.com/Philmod/google-cloud-build-slack/pull/30 created which allows one to specify the github owner, which is the missing piece in retrieving the github author for github app triggered builds.
Although the github repo is available in the build object, the github owner is only available in the build's trigger, which would need to be fetched but there is no lib for this https://github.com/googleapis/google-cloud-node#google-cloud-nodejs-client-libraries and I am unfamiliar with the raw https://github.com/googleapis/google-api-nodejs-client
https://issuetracker.google.com/issues/144151357 created, kindly star this issue.