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

Update readme #3

Merged
merged 5 commits into from
Apr 21, 2022
Merged
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
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