forked from SYu449/Auto-Fork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitFork.js
39 lines (31 loc) · 944 Bytes
/
gitFork.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//code to make fork post request to github api
//
const { Octokit } = require("@octokit/rest");
//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 --- please DO NOT copy/paste anywhere
const accToken = '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';
const testRepo = 'https://api.github.com/repos/CodesmithLLC/algorithms-elective';
//instantiate api
const octokit = new Octokit({
auth: accToken,
userAgent: 'auto-Fork',
timeZone: 'America/New_York',
//baseurl not required?
//debugging
log: {
debug: () => {},
info: () => {},
warn: console.warn,
error: console.error
},
request: {
agent: undefined,
fetch: undefined,
timeout: 0
}
});
//POST request to fork public repo for authenticate user. Happens asynchronously
await octokit.request('POST /repos/{owner}/{repo}/forks', {
owner: 'uitie',
repo: testRepo,
//organization optional
});