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.
The relevant portions of the GitHub error log are:
About list releases
exact_name_of_release_linux_n.1.2 _linux_n.1.2 2022-09-19T23:28:08Z
About to download release
release not found
Error: Process completed with exit code 1.
The complete code of the workflow is as follows:
download-a-release-linux:
runs-on: ubuntu-latest
steps:
- shell: bash
name: Download a Release
env:
VERSION: ${{ inputs.version }}
GH_TOKEN: ${{ secrets.GITPAT }}
run: |
echo "About list releases"
repoWithToken="https://"$GH_TOKEN"@github.com/accountName/repoName"
gh release list --repo $repoWithToken
echo "About to download release"
gh release download exact_name_of_release_linux_n.1.2 --repo $repoWithToken
echo "About to list contents of directory after download"
ls -al
The $repoWithToken
variable is being populated correctly because the gh release list --repo $repoWithToken
command runs without error as shown in the logs above.
The above uses docs from this link.
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.
Question
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
Create an empty repo with nothing other than:
- a workflow file that includes the
download-a-release-linux
job shown above, and - a
main.py
file with a simpleprint("Hello World")
command to represent an app.
- a workflow file that includes the
Create a release using the API as follows, which can be done in a preceding job in the same workflow above:
gh api \ --method POST \ -H "Accept: application/vnd.github+json" \ /repos/AccountName/RepoName/releases \ -f tag_name=$vers \ -f target_commitish='source-branch-name' \ -f name=$nameOfRelease \ -f body="$DESCRIPTION" \ -F draft=false \ -F prerelease=false \ -F generate_release_notes=false
Get the name of the release, which above we are calling
exact_name_of_release_linux_n.1.2
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.