How to use the Octokit function from @octokit/rest
Find comprehensive JavaScript @octokit/rest.Octokit code examples handpicked from public code repositorys.
GitHub: newrelic/node-newrelic
8 9 10 11 12 13 14 15 16 17
if (!process.env.GITHUB_TOKEN) { console.log('GITHUB_TOKEN recommended to be set in ENV') } const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }) class Github {
365
911
48
17 18 19 20 21 22 23 24 25 26
process.exit(); } const [owner, repo] = GITHUB_REPOSITORY.split('/'); const octokitDefaults = { owner, repo, pull_number }; const octokit = new Octokit({ auth }); /** * Do a diff on the current PR against main *
122
222
195
9 10 11 12 13 14 15 16 17 18
class GitHubRemoteService extends RemoteService { constructor ({ auth, baseUrl }, resourceCache) { super(resourceCache); this.octokit = new Octokit({ auth, baseUrl, userAgent, request: {
42
171
14
1 2 3 4 5 6 7 8 9
const { Octokit } = require('@octokit/rest'); let github; function githubAuthenticate() { github = new Octokit({ auth: process.env.GITHUB_TOKEN, }); }
13
124
4
28 29 30 31 32 33 34 35 36 37
function init() { // We will built a userOctokit IF a password (token) is given // if (!configuration.getOption("app-mode")) { if (configuration.getOption('password') != undefined) { const authString = "token " + configuration.getOption('password'); userOctokit = new Octokit({ userAgent: 'yoda-restapi', baseUrl: configuration.getOption('baseurl'), log: logger, auth: authString
23
90
13
+ 9 other calls in file
GitHub: alexivkin/forkrefresh
18 19 20 21 22 23 24 25 26 27
// most of the code below is no longer needed with the octokit v18 class Github { constructor(options = {}) { this.octokit=new octokitlib.Octokit() this.creds={} } async getCreds() {
20
31
4
2 3 4 5 6 7 8 9 10 11
const fs = require('fs-extra'); const path = require('path'); async function downloadAsserts(owner, repo, out) { const versions = {}; const github = new Octokit.Octokit(); const releaseResp = await github.repos.getLatestRelease({ owner, repo
2
24
6
18 19 20 21 22 23 24 25 26 27
} const LIB = ['skia', 'skparagraph', 'skshaper', 'svg', 'sktext', 'skunicode'] const ICU_DAT = 'icudtl.dat' const CLIENT = new Octokit({ auth: process.env.GITHUB_TOKEN, }) async function upload() {
53
0
12
GitHub: gopikrishna7/Nodeapp
119 120 121 122 123 124 125 126 127 128
/** * GET /api/github * GitHub API Example. */ exports.getGithub = async (req, res, next) => { const github = new Octokit(); try { const { data: repo } = await github.repos.get({ owner: 'sahat', repo: 'hackathon-starter' }); res.render('api/github', { title: 'GitHub API',
0
0
1
+ 4 other calls in file
@octokit/rest.Octokit is the most popular function in @octokit/rest (61 examples)