
I have opened an issue for discussion with the maintainers of the GitHub cli tool on the topic of the gh release list command's table columns' meanings not being explicitly documented.
#Github cli release code#
If you look at the source code implementing the gh release download command, you'll see that the "release not found" error is returned when FindDraftRelease doesn't find any releases, and tracing calls to FindDraftRelease, that it is called when FetchRelease's attempt to find a release with the given git tag doesn't find any non-draft releases when it makes a GitHub rest api call to get a release by a git tag.
The git tag of the release (which is what gh release download expects to receive). A "badge" indicating if the release is the latest release, a draft release, or a pre-release. The release name (which defaults to the git tag if no release name was set for the release). If you look at the source code implementing the gh release list command, you'll see that it prints a table where the columns are: Note: This is applicable to the source code of the v2.16.1 release, but future behaviour may change. You should just be able to use accountName/repoName. If you want to download those, use the -archive argument of the gh release download command.Īlso, I don't think you need to use repoWithToken if you are already setting the GH_TOKEN environment variable. Note (since you commented about this in confusion): the tarball and zipball are not part of the assets list of the release even though they are displayed in the same list as the other actual assets of the release in the GitHub releases UI. Gh release download _linux_n.1.2 -repo $repoWithToken Įcho "About to list release list -repo $repoWithToken You need to change your call to gh release download to use the git tag name of the release instead of the name of the GitHub release. What specifically needs to be changed in the gh release download cli command in the GitHub workflow code below in order for the exact_name_of_release_linux_n.1.2 release to be successfully downloaded? I only knew by reading the source code of the GitHub cli tool.
At the time of this writing, the docs for gh release list don't actually explain what each column of the output table mean. _linux_n.1.2 is the git tag name for that release. " exact_name_of_release_linux_n.1.2" is a GitHub release name- not a release git tag name. According to the docs for gh release download, the command takes a git tag name- not a GitHub release name. Run the workflow that contains the download-a-release-linux job using the code above with whatever modifications are required to get it to successfully download the release and list the valid contents of the app that are included in the release. Get the name of the release, which above we are calling exact_name_of_release_linux_n.1.2 f target_commitish='source-branch-name' \ H "Accept: application/vnd.github+json" \
a main.py file with a simple print("Hello World") command to represent an app.Ĭreate a release using the API as follows, which can be done in a preceding job in the same workflow above: gh api \. a workflow file that includes the download-a-release-linux job shown above, and. What specifically needs to be changed in the gh release download CLI command in the GitHub workflow code below in order for the exact_name_of_release_linux_n.1.2 release to be successfully downloaded? Steps to ReproduceĬreate an empty repo with nothing other than: The same error is thrown when we change the command to use the tag name as gh release download _linux_n.1.2 -repo $repoWithToken to more closely resemble the example given in the docs in the link. The $repoWithToken variable is being populated correctly because the gh release list -repo $repoWithToken command runs without error as shown in the logs above.
Gh release download exact_name_of_release_linux_n.1.2 -repo $repoWithTokenĮcho "About to list contents of directory after download" The complete code of the workflow is as follows: download-a-release-linux:Įcho "About list release list -repo $repoWithToken The relevant portions of the GitHub error log are: About list releasesĮxact_name_of_release_linux_n.1.2 _linux_n.1.2 Įrror: Process completed with exit code 1. A release not found error is being thrown with exit code 1 even when we cut and paste the precise name of a release that is returned by the gh release list -repo $repoWithToken command that runs immediately before.