Skip to content

Commit

Permalink
Update readme (#3)
Browse files Browse the repository at this point in the history
* Adding Dockerfile

* Add information about exporting values

* Add readme

* Update documentation to fix CLI

* Update doc by fixing lint
  • Loading branch information
bryantson authored Apr 21, 2022
1 parent 89a0d12 commit ff74ee7
Showing 1 changed file with 46 additions and 16 deletions.
62 changes: 46 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,53 @@
# Get Repository Statistics

This script can help you find information about your repositories in your system
GitHub CLI extensions are repositories that provide additional gh commands, and this GitHub CLI extension can help you find information about your repositories in your system.

## Prerequisites

- You need to have GitHub CLI installed by following this documentation: <https://github.com/cli/cli#installation>
- You need to have an operating system to run shell script

You need to either export these environment variables

| Environment Variable name | Value |
| ------------------------- | ----- |
| GITHUB_TOKEN | GitHub Personal Access Token (PAT) with `admin:org`, `user:all`, and `repo:all` permissions
| ORG_NAME | Organization name to run script |
| GHE_URL | GitHub URL or GHES URL without HTTP or HTTPS |

You can export these environment variables with following commands:

```sh
export GITHUB_TOKEN=<Your GitHub PAT>
export ORG_NAME=<Your Org name>
export GHE_URL=<Your GHE URL>
```

You can also create an environment variable named `.env` in following format:

```sh
GITHUB_TOKEN=<Your GitHub PAT>
ORG_NAME=<Your Org name>
GHE_URL=<Your GHE URL>
```

Then, you can source with a following command:

```sh
source .env
```

## How to run
- Download the folder `get-repo-statistics` to your local machine
- Use `git-bash` to run the following commands
- Change into the directory
- `cd get-repo-statistics`
- Build the `Dockerfile`
- `docker build -t github/runner:latest -f Dockerfile .`
- This will build the container image: `github/runner:latest` with the needed scripts and libraries inside
- Run the container and map to a local folder to pull out data
- `docker run -it --entrypoint /bin/bash -v /tmp:/tmp github/runner:latest`
- This command will start the container and drop you into the running container, with the `/tmp` directory mounted to your personal machines `/tmp` directory
- You can now run the script from the container
- `./get-repo-statistics.sh`
- Give the script information about `url`, `token`, and `organization`

## Input file

Make sure you followed prerequisites and then follow this instruction.

### Step 1: Install GitHub extension

```sh
gh extension install mona-actions/gh-repo-stats
```

### Input file
If you want to run this over multiple Orgs, you can pass an `input file` when starting the script
- `./get-repo-statistics.sh --input Org-file.csv`
- This will read in a list of orgs and run over the list
Expand Down

0 comments on commit ff74ee7

Please sign in to comment.