Created
October 19, 2023 18:39
-
-
Save copremesis/c3d8d482daa9e7b22a82b654f7cbab7e to your computer and use it in GitHub Desktop.
automating the use of gist
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
// Octokit.js | |
// https://github.com/octokit/core.js#readme | |
//import fetch from 'node-fetch'; | |
//import { Octokit, App } from "octokit"; | |
const fetch = require('node-fetch-commonjs'); | |
import { Octokit } from '@octokit/rest'; | |
const octokit = new Octokit({ | |
request: { | |
fetch: fetch, | |
}, | |
auth: process.env.TOK | |
}) | |
const go = async () => { | |
await octokit.request('POST /gists', { | |
description: 'Example of a gist', | |
'public': false, | |
files: { | |
'README.md': { | |
content: 'Hello World' | |
} | |
}, | |
headers: { | |
'X-GitHub-Api-Version': '2022-11-28' | |
} | |
}) | |
} | |
go(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment