Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Repo Maintenence Scripts

This directory contains a set of scripts useful for repo maintenence.
1 change: 1 addition & 0 deletions scripts/get-repos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
30 changes: 30 additions & 0 deletions scripts/get-repos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Repo List

List all PL repos. Currently, this script lists all Go & JavaScript repos in the following orgs:

- ipfs
- ipfs-shipyard
- ipld
- libp2p
- multiformats

It outputs them as a JSON array.

## Install

Before usage, you'll need to install the dependencies.

```bash
$ npm install
```

## Usage

```bash
$ node index.js
```

If you run into GitHub's rate limits, try setting the GITHUB_TOKEN environment variable:
```bash
$ GITHUB_TOKEN=your_token node index.js
```
34 changes: 34 additions & 0 deletions scripts/get-repos/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {Octokit} from '@octokit/rest'

const LANGUAGES = ["JavaScript", "Go"]
const ORGS = ["ipfs", "ipfs-shipyard", "ipld", "libp2p", "multiformats"]

const options = {}
if (process.env.GITHUB_TOKEN) {
options.auth = process.env.GITHUB_TOKEN
}

const octokit = new Octokit(options)

async function list_repos(orgs, langs) {
let results = []
for (const org of orgs) {
for await (const resp of octokit.paginate.iterator(octokit.rest.repos.listForOrg, {org})) {
for (const repo of resp.data) {
if (repo.private || repo.archived) {
continue
}
if (!langs.includes(repo.language)) {
continue
}
results.push(repo.full_name)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I slightly changed the output here to make this script a little more universally applicable. It now just outputs a list of repos (strings), not wrapped in a { target: "<repo>" } object.

}
}
}
return results.sort((a, b) => a.full_name < b.full_name)
}

(async () => {
let repos = await list_repos(ORGS, LANGUAGES)
console.log(JSON.stringify(repos))
})()
Loading