Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up for an initial release #15

Merged
merged 9 commits into from
Jan 28, 2021
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `orglinter`

## 0.1.0

- Initial MVP release
92 changes: 59 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,65 @@

Lint GitHub organizations to ensure proper membership lists and configuration.

## Installation

`orglinter` is designed to be installed with npm or yarn, either globally:

```console
$ npm install -g orglinter
$ orglinter my-org-file.toml
```

Within your package:

```console
$ npm install orglinter
$ npx orglinter my-org-file.toml
```

Or if you would like to make contributions to `orglinter`, using `git` and `npm`
for local development:

```console
$ git clone [email protected]:godaddy/orglinter.git
$ cd orglinter
$ npm install
$ npm start my-org-file.toml
```

## Usage

A stub `.env.dist` file can be found for the convenience of users and developers
at the root of this project. If you copy this file to `.env` and fill in the
blanks, you should be good to go!

Running the script requires a single environment variable, which you can place
into a `.env` file for automatic ingestion: `GITHUB_TOKEN`. This must be a
personal access token generated by an existing organization owner, with the
following permissions:

* `admin:org`
* `read:user`

Once a `GITHUB_TOKEN` is ready, the script can be run by `npm start`.

By default, the tool will look for a file at `./membership.toml`. However you
can also specify a different filename on the command line such as:

```console
$ npm start my-org-file.toml

> [email protected] start
> node ./src/bin/cli.js
# ...
```

At the time of this writing, this script will be run manually after every change
to the membership file. In the future, this will become an automatic execution
in the CI pipeline, and will also be run on a regular basis to ensure that
undocumented memberships do not exist, and that employees who have left the
company are removed from the org.

## Org Specification

All org data is stored in [TOML] files; one file representing one GitHub org. An
Expand Down Expand Up @@ -58,39 +117,6 @@ does have the side effect that, if an internal username is connected to multiple
GitHub usernames, as demonstrated above, all of those GitHub usernames will be
made admins of the org.

## Script Execution

A stub `.env.dist` file can be found for the convenience of users and developers
at the root of this project. If you copy this file to `.env` and fill in the
blanks, you should be good to go!

Running the script requires a single environment variable, which you can place
into a `.env` file for automatic ingestion: `GITHUB_TOKEN`. This must be a
personal access token generated by an existing organization owner, with the
following permissions:

* `admin:org`
* `read:user`

Once a `GITHUB_TOKEN` is ready, the script can be run by `npm start`.

By default, the tool will look for a file at `./membership.toml`. However you
can also specify a different filename on the command line such as:

```console
$ npm start my-org-file.toml

> [email protected] start
> node ./src/bin/cli.js
# ...
```

At the time of this writing, this script will be run manually after every change
to the membership file. In the future, this will become an automatic execution
in the CI pipeline, and will also be run on a regular basis to ensure that
undocumented memberships do not exist, and that employees who have left the
company are removed from the org.

## Credits

Originally developed internally for making easier work of the management of
Expand Down
6 changes: 3 additions & 3 deletions src/bin/cli.js → bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

require('dotenv').config();
const path = require('path');
const checkers = require('../lib/checkers');
const fixers = require('../lib/fixers');
const loaders = require('../lib/loaders');
const checkers = require('../src/lib/checkers');
const fixers = require('../src/lib/fixers');
const loaders = require('../src/lib/loaders');

(async () => {
const DRY_RUN = !!process.env.DRY_RUN || false;
Expand Down
24 changes: 21 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "orglinter",
"version": "1.0.0",
"version": "0.1.0",
"description": "Ensure proper membership list and config for GitHub orgs",
"scripts": {
"lint": "eslint .",
"start": "./src/bin/cli.js",
"start": "./bin/cli.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -27,6 +27,24 @@
"eslint-config-godaddy": "^4.0.1"
},
"bin": {
"orglinter": "./src/bin/cli.js"
"orglinter": "./bin/cli.js"
},
"keywords": [
"github",
"linting",
"organization management",
"membership",
"users",
"synchronize"
],
"bugs": {
"url": "https://github.com/godaddy/orglinter/issues"
},
"files": [
"bin/",
"src/"
],
"engines": {
"node": ">= 12.0.0"
}
}