How to use the repos function from @octokit/rest

Find comprehensive JavaScript @octokit/rest.repos code examples handpicked from public code repositorys.

19
20
21
22
23
24
25
26
27
28
    return reject(err);
  });
}

return new Promise((resolve, reject) => {
  octokit.repos.getForOrg(options).then((response) => {
    repos = repos.concat(parseRepos(response));
    getRemanding(response, resolve, reject);
  }).catch((err) => {
    return reject(err);
fork icon13
star icon34
watch icon74

8
9
10
11
12
13
14
15
16
17
  type: 'basic',
  username: 'YOUR_GITHUB_USERNAME_HERE',
  password: 'YOUR_GITHUB_PERSONAL_ACCESS_TOKEN_HERE',
})

const opt = octokit.repos.listForOrg.endpoint.merge({ org: 'devsisters' })
for await (const res of octokit.paginate.iterator(opt)) {
  if (res.status !== 200) {
    process.exit(-1)
  }
fork icon2
star icon31
watch icon5

+ 3 other calls in file

10
11
12
13
14
15
16
17
  token: GITHUB_AUTH,
})

module.exports = {
  pullRequest: octokit.pullRequests.create,
  release: octokit.repos.createRelease,
  merge: octokit.pullRequests.merge,
}
fork icon1
star icon12
watch icon137

+ 3 other calls in file

35
36
37
38
39
40
41
42
43
44
  }
}


async paginate (orgName) {
  let response = await octokit.repos.getForOrg({
    org: orgName,
    type: 'all',
    per_page:100
  })
fork icon0
star icon1
watch icon4

+ 3 other calls in file

15
16
17
18
19
20
21
22
23
24
async function execScript() {
  // Compare: https://developer.github.com/v3/repos/#list-organization-repositories
  let dt = new Date();
  dt.setFullYear(dt.getFullYear() -1);
  console.info('This search will return just the repos updated after' + dt);
  paginate(() => octokit.repos.getForOrg({
    org: 'aerogear',
    archived: false
  })).then(data => {
    // handle data
fork icon2
star icon0
watch icon19

18
19
20
21
22
23
24
25
26
27
      data = data.concat(response.data)
  }
  return data
}

paginate(() => octokit.repos.getForOrg({org: process.env.org}))
  .then(data => {
    fs.writeFileSync('/repos', JSON.stringify(data));
  }).catch(err => {
      console.log(err.message);
fork icon1
star icon0
watch icon5

89
90
91
92
93
94
95
96
97
98
octokit.authenticate({
  type: 'oauth',
  token: process.env.GH_TOKEN
});

await octokit.repos.createRelease({
  owner: 'ionic-team',
  repo: 'ionic',
  target_commitish: 'master',
  tag_name: tag,
fork icon0
star icon1
watch icon1

+ 4 other calls in file

90
91
92
93
94
95
96
97
98
99
```

Multiple preview headers can be combined by separating them with commas

```js
const {data: {topics, code_of_conduct}} = octokit.repos.get({
  owner: 'octokit',
  repo: 'rest.js',
  headers: {
    accept: 'application/vnd.github.mercy-preview+json,application/vnd.github.scarlet-witch-preview+json'
fork icon0
star icon0
watch icon8

+ 5 other calls in file