This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
# uses 1pass to get token from 1password vault | |
export GITHUB_API_TOKEN=`1pass "github api token"` | |
function ghapi() { | |
# escape double quotes as we need to insert the passed heredoc into a json string | |
# optionally we could build this with jq? | |
local json=$(cat | sed 's/"/\\"/g') | |
curl -sS -K <(cat <<<"header \"Authorization: token $GITHUB_API_TOKEN\"") -X POST https://api.github.com/graphql -d @- <<EOT |