Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
internshiplogs cite-github.fish
760 B · 39 lines
at main
12345678910111213141516171819202122232425262728293031323334353637383940function cite-github set id $argv[1] set owner $argv[2] set repo $argv[3]
set query ' query ($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { name owner { login, ...on Organization { name } } createdAt url } }'
set citation '{ $id: { type: "repository", title: .name, publisher: "GitHub", author: .owner.name, url: { date: $today, value: .url }, date: .createdAt | sub("T.+$"; "") } }'
set data ( gh api graphql -F owner=$owner -F repo=$repo -f query="$query" | jq .data.repository )
echo "Adding $data"
echo "$data" | yq -Y "$citation" \ --arg today (date --iso-8601) \ --arg id $id \ >> bib.yaml
# Add a blank line echo >> bib.yaml end