/tako

🐙 A GitHub App that provides an API listing the repositories it is installed on.

Primary LanguageJavaScriptMIT LicenseMIT

🐙 Tako

A GitHub App that provides an API listing the GitHub repositories it is installed on.

"Tako" is "Octopus" translated to Japanese.

Deploy

FT.com shares the Financial-Times GitHub organisation with many other teams, containing over three thousand repositories.

We use Tako to make a canonical list of the FT.com team's two hundred or so repositories. This list is available via an API for tooling and automation.

GET /tako/repositories

Get a list of all the repositories.

{
  "repositories": [
    {
      "name": "foo-bar",
      "owner": "acme",
      "topics": ["example"]
    }
  ]
}

GET /tako/repositories/?topic=serverless

Get a list of repositories, filtered by a topic.

{
  "repositories": [
    {
      "name": "foo-bar",
      "owner": "acme",
      "topics": ["example"]
    }
  ]
}

Security

You can secure the /tako/repositories endpoint by setting the BEARER_TOKEN environment variable.

You must then send an Authorization header with a value of Bearer <your-token> in your requests.

Development

Getting Started

  1. Build the application
# If you use nvm, install the correct version of Node.js (defined in .nvmrc)
nvm use

# Install any dependencies
npm install

# Start the application locally (restarting on changes to the code)
npm run dev
  1. Go to http://localhost:3000/probot in a browser, and click on "Register GitHub App"

  2. Rename the app to something that isn't already registered, e.g. "Sam's Development Tako"

  3. Install the app in your personal GitHub account, then pick an example repository or two in the drop down

  4. Probot will then automatically create you a .env file in your local working directory (you can add LOG_LEVEL=trace for more verbose logging)

You're now good to go 🎉. Check out http://localhost:3000/tako/repositories.

GitHub also have some great documentation on building a GitHub App.

Formatting and Code Quality

This project uses a few tools to help us with consistent formatting and code quality.

EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.

The settings for EditorConfig are defined in our .editorconfig file and your editor probably already supports it without the need for a plugin.

Prettier is an opinionated code formatter.

We use the default settings for prettier, but it also takes specific settings from our .editorconfig file into account as well.

If you'd like to use prettier in your editor there are plugins available for most popular editors.

There's an excellent explanation about how Prettier differs to a linter this in the Prettier docs.

Format your code before committing with npm run format.

The pluggable linting utility for JavaScript and JSX

The settings for eslint are defined in our .eslintrc.js file.

We use the eslint-config-prettier preset to disable any rules that conflict with formatting that is handled by prettier.

If you'd like to use eslint in your editor there are plugins available for most popular editors.