Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour on artifact upload to existing release #107

Open
jetkov opened this issue Dec 1, 2018 · 2 comments
Open

Unexpected behaviour on artifact upload to existing release #107

jetkov opened this issue Dec 1, 2018 · 2 comments

Comments

@jetkov
Copy link

jetkov commented Dec 1, 2018

I am seeing strange behavior with both ghr and GitHub when uploading multiple new artifacts to an existing release, with an existing tag. The exact same flow worked fine a couple of weeks ago. The command I am using is

ghr -token **** -u RepoOwner -r Repo -c 98fd86794be759e412842a12a8b0db8f36151eff -n v0.16.0 release/v0.16.0 ./Deploy/v0.16.0

The same command is then run subsequently in different folders for different artifacts. Some artifacts upload without error, however others experience the error

Failed to publish release: failed to edit release: 14293732: PATCH    
https://api.github.com/repos/RepoOwner/Repo/releases/14293732: 422 Validation Failed    
[{Resource:Release Field:tag_name Code:already_exists Message:}]

or

Failed to upload one of assets: one of the goroutines failed: failed to upload asset:   
/path/to/artifact.tar.gz: failed to upload release asset: /path/to/artifact.tar.gz: POST    
https://uploads.github.com/repos/RepoOwner/Repo/releases/14293732/assets?name=artifact.tar.gz:  
422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}]   

The interesting thing is that on the GitHub release page, the artifacts are there and I have verified they were uploaded correctly. Strangely, there seems to also be a bug with the GitHub interface where if you look at the list of releases, it only shows one artifact under the release, but when you open the release itself, all of the artifacts are present.

@miguelangel-nubla
Copy link

I also encountered this, found why.

-replace
	Replace artifacts if it is already uploaded. ghr thinks it's same when
	local artifact base name and uploaded file name are same.

I noticed that some characters on the filename get replaced when uploading.
For me it was ":". After uploading the release had the file with a ".", then on re upload the same file ghr do not find the original file name with ":", so thinks it is a new one and therefore the bug.

@crazyoptimist
Copy link

crazyoptimist commented Jul 26, 2021

My scenario is like this:
I create a release tag and push to the Github, then CI workflow runs for the tag, then ghr will upload artifacts to the tag I created.
Will this work or end up with the error related to this issue?
I didn't try this yet, just want to confirm before using this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants