Skip to content

Instantly share code, notes, and snippets.

@mschauer
Created May 1, 2021 12:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mschauer/2c39979b73b28721b4279a5a47bb5280 to your computer and use it in GitHub Desktop.
Save mschauer/2c39979b73b28721b4279a5a47bb5280 to your computer and use it in GitHub Desktop.
create_gist.jl
using GitHub, JSON
#myauth = GitHub.authenticate(ENV["GITHUB_AUTH"])
gist_json(fn; description="$fn", public=true) = JSON.parse(
"""
{
"description": "$description",
"public": $public,
"files": {
"$fn": {
"content": "$(escape_string(read(fn, String)))"
}
}
}
""")
my_params=gist_json("create_gist.jl")
mygist = GitHub.create_gist(params=my_params, auth=myauth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment