action-gh-release icon indicating copy to clipboard operation
action-gh-release copied to clipboard

enhancement: display more helpful error message other than undefined

Open networkhermit opened this issue 1 year ago • 8 comments

Currently when the action fails it displays undefined as part of the error message, which is not very helpful for debugging.

👩‍🏭 Creating new GitHub release for tag latest...
⚠️ GitHub release failed with status: 403
undefined
retrying... (2 retries remaining)
👩‍🏭 Creating new GitHub release for tag latest...
⚠️ GitHub release failed with status: 403
undefined
retrying... (1 retries remaining)
👩‍🏭 Creating new GitHub release for tag latest...
⚠️ GitHub release failed with status: 403
undefined
retrying... (0 retries remaining)
❌ Too many retries. Aborting...
Error: Too many retries.

I believe the specific line is in https://github.com/softprops/action-gh-release/blob/9b795e578288d5ff64564dfa7dd4cda7b04bb648/src/github.ts#L316

It seems that more helpful error message can be displayed (taken from my scratch fork to troubleshooting a coredns release issue):

          }\n${error}\nretrying... (${
👩‍🏭 Creating new GitHub release for tag v1.11.2 using commit "01bded8194be73ce4601ad608a0464166cee932a"...
⚠️ GitHub release failed with status: 403
HttpError: Resource not accessible by integration
retrying... (2 retries remaining)
👩‍🏭 Creating new GitHub release for tag v1.11.2 using commit "01bded8194be73ce4601ad608a0464166cee932a"...
⚠️ GitHub release failed with status: 403
HttpError: Resource not accessible by integration
retrying... (1 retries remaining)
👩‍🏭 Creating new GitHub release for tag v1.11.2 using commit "01bded8194be73ce4601ad608a0464166cee932a"...
⚠️ GitHub release failed with status: 403
HttpError: Resource not accessible by integration
retrying... (0 retries remaining)
❌ Too many retries. Aborting...
Error: Too many retries.

Related issue showing undefined: #217 #400 #411 #429

I'm not very familiar with typescript and the tooling used, so I hope some existing contributor or volunteer could help improve it.

Even more helpful error message other than plain undefined is appropriated too.

networkhermit avatar Apr 10 '24 05:04 networkhermit

Thanks for capturing this in one gh issue. It's possible this regressed in a version bump. The point of logging the error was to provide helpful debugging when something goes wrong. I agree it's not at all helpful at the moment printing undefined.

I'm hoping to anyone willing to help with this one.

softprops avatar Apr 10 '24 14:04 softprops

@softprops just ran into this too, can you try to dump the entire response since errors seems undefined? Or what do you think is required to help?

till avatar May 02 '24 07:05 till

It seems like I cannot run this from a branch? Like I need to run some command to regenerate dist? If you can add details as I am also not familiar with TypeScript, then I can try to help.

till avatar May 02 '24 09:05 till

@till ah yes, if you run npm install to make sure you have dependencies installed then you can run npm build to generate a new packaged distribution file. This is ultimately what github actions uses as an entrypoint for the action

softprops avatar May 02 '24 13:05 softprops

I just merged https://github.com/softprops/action-gh-release/pull/447 could someone on this issue thread try a test release using the current master branch of this action? once we starting seeing data it should start shaking out the underlying issue

softprops avatar May 06 '24 13:05 softprops

That was supposed to be for testing 😆

till avatar May 06 '24 16:05 till

no worries. the more info we can gather the sooner we can get the underlying issue addressed

softprops avatar May 06 '24 17:05 softprops

I figured out my problem: PAT was missing some permissions. In the end used the workflow token again and configured it appropriately.

till avatar May 06 '24 20:05 till