google-cloud-build-slack icon indicating copy to clipboard operation
google-cloud-build-slack copied to clipboard

Fix author

Open naseemkullah opened this issue 6 years ago • 10 comments

This is implements a workaround for github owner info not being available in the github app triggered build object, but wanting to fetch the author info.

Also some slight refactoring and package update.

naseemkullah avatar Nov 02 '19 11:11 naseemkullah

bump

naseemkullah avatar Nov 08 '19 14:11 naseemkullah

I would prefer not to add yet another configuration. Why is this necessary? Is it missing in the build information? In which case a bug should be filed to Cloud Build.

Philmod avatar Nov 08 '19 14:11 Philmod

Github repo owner information is indeed missing from the build object. It is used to fetch the github author info. This is an imperfect but good enough work around until Cloud Build provides either github owner or github commit author or both in the build object of a github app triggered build. When they do I will gladly remove the excess code if this is merged.

If we do not merge this and cloud build cannot provide the required info in the build object, we should advise/set a guard that fetching author info is not possible with github app triggered builds.

naseemkullah avatar Nov 08 '19 14:11 naseemkullah

Did you file a bug to Cloud Build? Can you link it here?

Philmod avatar Nov 08 '19 15:11 Philmod

https://issuetracker.google.com/issues/144151357 created! Kindly star the issue.

naseemkullah avatar Nov 08 '19 15:11 naseemkullah

I tried this and I only get Error: TypeError: Cannot read property 'author' of undefined

LanceSandino avatar Dec 03 '19 17:12 LanceSandino

Hi @LanceSandino this is for github triggered apps right? We will have to wait for https://issuetracker.google.com/issues/144151357 for a proper solution. At which point I think we will remove all the github fetching code and just say that we need to use github triggered apps for author info, which will be provided in build objects.

If you need this now though fork my branch and provide GITHUB_TOKEN and GITHUB_OWNER values

naseemkullah avatar Dec 03 '19 18:12 naseemkullah

Hi @LanceSandino this is for github triggered apps right? We will have to wait for https://issuetracker.google.com/issues/144151357 for a proper solution. At which point I think we will remove all the github fetching code and just say that we need to use github triggered apps for author info, which will be provided in build objects.

If you need this now though fork my branch and provide GITHUB_TOKEN and GITHUB_OWNER values

I did fork yours, and that's where I got the TypeError 'author' :(

LanceSandino avatar Dec 03 '19 20:12 LanceSandino

Hi @LanceSandino this is for github triggered apps right? We will have to wait for https://issuetracker.google.com/issues/144151357 for a proper solution. At which point I think we will remove all the github fetching code and just say that we need to use github triggered apps for author info, which will be provided in build objects. If you need this now though fork my branch and provide GITHUB_TOKEN and GITHUB_OWNER values

I did fork yours, and that's where I got the TypeError 'author' :(

Oh ok, sorry. Maybe best we wait for https://issuetracker.google.com/issues/144151357

naseemkullah avatar Dec 06 '19 06:12 naseemkullah

Hi @naseemkullah ,

I also made a PR #33 , for me this is in addition to yours, just to avoid doing extra steps not needed if no GitHub token (and also avoiding the issue you target).

sneko avatar Mar 24 '20 12:03 sneko