Request GET from API returns an empty JSON array

I’ve been having a problem in getting all contributor commit activity statistics from the GitHub REST API. In a workflow, I run this following script:

run: |
          curl --request GET \
          --url${{ github.repository }}/stats/contributors \
          --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
          --header 'content-type: application/json' > contribute.json

No run errors here, but when I write this to a JSON file, it only contains an empty JSON array:



Does anyone know the problem of why it is outputting an empty JSON file? This is a private repository if it helps with finding the problem. Thanks in advance!

:wave: @kkarp9: an empty JSON array is returned if there are no contributors beyond the initial committer. Here’s an example public repository showcasing this behavior:

Does this help explain what you’re seeing? :thought_balloon:

Thank you for reaching out on this. Yes, I do have contributors. I verified it on my repos. An update to this issue is that for some reason when I run the workflow to request GitHub API from other branches that I have, it returns the JSON array of all contributors. Only in the master branch I get the empty JSON array. Any intake on this?