How to get raw github data using github API

Viewed 848
1 Answers

As seen here, try

curl -GLOf -H "Authorization: token ${GITHUB_TOKEN?not set}" \
-H "Accept: application/vnd.github.v4.raw" \
  "https://api.github.com/repos/$ORG/$REPO/contents/$FILEPATH" -d ref="$REVISION"

In your case, for a public repository:

curl -GLOf -H "Accept: application/vnd.github.v4.raw" \
  "https://api.github.com/repos/graphql-compose/graphql-compose-examples/contents/examples/northwind/data/csv/employees.csv"

I just tested it, and got a file employees.csv with its raw content in it.

Related