Skip to content

Instantly share code, notes, and snippets.

@copremesis
Created October 19, 2023 18:39
Show Gist options
  • Save copremesis/c3d8d482daa9e7b22a82b654f7cbab7e to your computer and use it in GitHub Desktop.
Save copremesis/c3d8d482daa9e7b22a82b654f7cbab7e to your computer and use it in GitHub Desktop.
automating the use of gist
// 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