Getting jq error (at <stdin>:1): Cannot index string with string "tag_name" with simple API call #33700
-
Greetings, We have a MacOS Github Action that attempts to generate release artifacts. We've hit a very strange error with a seemingly mundane request. Our relevant yaml section is: - id: get-id
name: Compute needed variables
run: |
set -x
id=$(echo ${{ github.repository }} | cut -d- -f2)
echo "::set-output name=id::$id"
echo "id is '$id'"
tag=$(echo ${{ github.ref }} | cut -d '/' -f3)
echo "::set-output name=tag::$tag"
echo "tag is '$tag'"
rel_id=$(curl -sL https://api.github.com/repos/${{github.repository}}/releases | jq -r --arg TAG "$tag" '.[] | select(.tag_name==$TAG) | .id')
echo ::set-output name=rel_id::$rel_id
echo "rel_id is '$rel_id'"
version=$(echo ${{ github.ref }} | cut -d '/' -f3 | cut -c 2- | sed 's/\./_/g')
echo "::set-output name=version::$version"
echo "version is '$version'" An example CI failure reports:
This failure seems flakey / transient as yesterday we simply reordered the run commands and got a working result. Anybody have ideas on what is causing this to happen? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
We continue to see this issue: seemingly transient failures on the /releases API endpoint from GHA. |
Beta Was this translation helpful? Give feedback.
-
Could it be that your request is getting rate limited or something? Adding |
Beta Was this translation helpful? Give feedback.
Could it be that your request is getting rate limited or something? Adding
-v
to thecurl
command line andecho
ing the returned data could show that. Or you could go right to authorizing the request with theGITHUB_TOKEN
, and if that gets rid of the problem it probably was that.