You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
githubrelease --github-token [...] release hdmf-dev/hdmf create test --name test --publish dist/*
A new release is correctly created in the GitHub repo. However, the assets are not uploaded, and this error is raised:
created 'test' release
File "/opt/hostedtoolcache/Python/3.10.5/x64/bin/githubrelease", line 8, in <module>
sys.exit(main())
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
Tag name : test
Name : test
ID : [...]
Created : 2022-08-05T18:30:49Z
URL : https://github.com/hdmf-dev/hdmf/releases/tag/test
Author : ***
Is published : True
Is prerelease : False
return ctx.invoke(self.callback, **ctx.params)
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/click/decorators.py", line [33](https://github.com/hdmf-dev/hdmf/runs/7696943621?check_suite_focus=true#step:9:34), in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/github_release.py", line 4[37](https://github.com/hdmf-dev/hdmf/runs/7696943621?check_suite_focus=true#step:9:38), in cli_release_create
gh_release_create(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/github_release.py", line 116, in with_check_for_credentials
return func(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/github_release.py", line [46](https://github.com/hdmf-dev/hdmf/runs/7696943621?check_suite_focus=true#step:9:47)9, in gh_release_create
gh_asset_upload(repo_name, tag_name, asset_pattern, dry_run=dry_run)
File "/opt/hostedtoolcache/Python/3.10.5/x[64](https://github.com/hdmf-dev/hdmf/runs/7696943621?check_suite_focus=true#step:9:65)/lib/python3.10/site-packages/github_release.py", line 116, in with_check_for_credentials
return func(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/github_release.py", line 724, in gh_asset_upload
upload_url = get_release_info(repo_name, tag_name)["upload_url"]
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/github_release.py", line 272, in get_release_info
raise Exception('Release with tag_name {0} not found'.format(tag_name))
Exception: Release with tag_name test not found
where a POST request is made to create the release and then, almost immediately after, gh_asset_upload is called, which calls get_release_info, which calls get_release, which calls get_releases, which makes a GET request for the releases. I suspect that after the POST request is made to create a new release, when the GET request is made to fetch data about this new release, the GitHub data has not yet been updated fast enough. Indeed, adding time.sleep(1) or time.sleep(0.1) right before gh_asset_upload is called fixed the issue! This does not feel like a great solution, but I see time.sleep(0.1) elsewhere in the script, so perhaps it is fine. Unless a better solution is suggested, I suggest this as a fix.
A workaround is to use two commands: one to create and publish the release, and another to upload assets:
githubrelease --github-token [...] release hdmf-dev/hdmf create test --name test --publish
githubrelease --github-token [...] asset hdmf-dev/hdmf upload test dist/*
This still results in an error in the first command because gh_release_create always calls gh_asset_upload. I think it should not always call gh_asset_upload; this is another bug which I will create a separate issue for.
The text was updated successfully, but these errors were encountered:
rly
added a commit
to rly/github-release
that referenced
this issue
Aug 7, 2022
When creating a new release using:
A new release is correctly created in the GitHub repo. However, the assets are not uploaded, and this error is raised:
In
gh_release_create
, there is this code:https://github.com/j0057/github-release/blob/4ad1a66a34620ace9e881d9ce0fcc14994cdab30/github_release.py#L529-L540
where a POST request is made to create the release and then, almost immediately after,
gh_asset_upload
is called, which callsget_release_info
, which callsget_release
, which callsget_releases
, which makes a GET request for the releases. I suspect that after the POST request is made to create a new release, when the GET request is made to fetch data about this new release, the GitHub data has not yet been updated fast enough. Indeed, addingtime.sleep(1)
ortime.sleep(0.1)
right beforegh_asset_upload
is called fixed the issue! This does not feel like a great solution, but I seetime.sleep(0.1)
elsewhere in the script, so perhaps it is fine. Unless a better solution is suggested, I suggest this as a fix.A workaround is to use two commands: one to create and publish the release, and another to upload assets:
This still results in an error in the first command because
gh_release_create
always callsgh_asset_upload
. I think it should not always callgh_asset_upload
; this is another bug which I will create a separate issue for.The text was updated successfully, but these errors were encountered: