Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

Commit 2b65045

Browse files
authored
Merge pull request GSA#11 from GSA/jrc_updates-readme
Updated documentation for both metrics folders and run processes
2 parents 4008acb + 92ed7f5 commit 2b65045

File tree

1 file changed

+71
-16
lines changed

1 file changed

+71
-16
lines changed

README.md

+71-16
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
1-
# code-gov-github-metrics
2-
This project compiles and calculates GitHub metrics across [the different repos that make up Code.gov](https://github.com/GSA/code-gov) so that the Code.gov team can understand and track community contributions and other data points over time.
1+
This repo contains scripts for gathering GitHub API data pertaining to Code.gov and federal government repositories. These *engagement* metrics in code-gov-repo-metrics and government-wide-repo-metrics are slightly different but generally include forks, starts, watchers, and issues per repository. Furthermore, the process to run the metrics is different with specific instructions per type of metric included here.
32

4-
This project uses the [GitHub GraphQL API v4](https://developer.github.com/v4/).
5-
6-
7-
## Getting Started
8-
First clone the repo locally:
3+
To obtain code-gov-repo-metrics and government-wide-repo-metrics, begin by cloning the repo.
94

105
```
116
git clone https://github.com/GSA/code-gov-github-metrics.git
127
```
138

14-
Then move into the repo's directory and install the NPM dependencies:
9+
<hr>
10+
11+
# code-gov-repo-metrics
12+
This folder compiles GitHub metrics across the [different repos]((https://github.com/GSA/code-gov)) that make up Code.gov.
13+
14+
This portion of the project uses the [GitHub GraphQL API v4](https://developer.github.com/v4/).
15+
16+
## Getting Started
17+
After cloning the entire repo, move into the repo's directory and folder and install the NPM dependencies.
1518

1619
```
17-
cd code-gov-github-metrics
20+
cd code-gov-github-metrics/code-gov-repo-metrics
1821
npm install
1922
```
2023

21-
Next, create a .env file based on the template:
24+
Next, create a .env file based on the template.
2225

2326
```
2427
cp .env.example .env
2528
```
2629

27-
Now, [create a GitHub Personal Access Token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line#creating-a-token). You should only need to enable the "repo" scope (the first checkbox) when creating your token. Once you have your token, insert it into the newly created .env file, replacing `<INSERT YOUR PERSONAL ACCESS TOKEN HERE>`. Don't include any spaces or quotes in the .env file!
30+
Now, [create a GitHub Personal Access Token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line#creating-a-token). You should only need to enable the "repo" scope (the first checkbox) when creating your token. Once you have your token, insert it into the newly created .env file, replacing `<INSERT YOUR PERSONAL ACCESS TOKEN HERE>`. Don't include curved brackets (<>), spaces (" "), or quotes ("") in the .env file!
2831

2932
## Configuration
3033

3134
The main script will query the GitHub repositories specified in [`config.json`](https://github.com/GSA/code-gov-github-metrics/blob/master/config.json). In this file, `owner` refers to the GitHub organization that owns the repositories (in this case, GSA) and `repoList` is the list of repositories to include in the report. This script should be reusable for different organizations/repositories by changing [`config.json`](https://github.com/GSA/code-gov-github-metrics/blob/master/config.json) accordingly.
3235

3336
## Usage
3437

35-
To generate a new report, run a command like the one below:
38+
To generate a report, run the following command.
3639

3740
```
3841
npm run start <START OF TIME PERIOD TO QUERY> <END OF TIME PERIOD TO QUERY>
@@ -54,7 +57,7 @@ The report contains a number of metrics about the repositories for all time and
5457

5558
### Saving and visualizing reports
5659

57-
For the code.gov team, reports should be run monthly on a regular schedule to keep track of these metrics over time. These reports should be uploaded to the GitHub Metrics Google Sheet in the code.gov team drive. To upload a new report:
60+
For the Code.gov team, reports should be run monthly on a regular schedule to keep track of these metrics over time. These reports should be uploaded to the GitHub Metrics Google Sheet in the Code.gov team drive. To upload a new report:
5861

5962
* In the Google Sheet, click on `File > Import`
6063
* Click `Upload`
@@ -65,15 +68,67 @@ For the code.gov team, reports should be run monthly on a regular schedule to ke
6568

6669
After following these steps, the report will be saved in Google Sheets (which is important because the reports are included in the [`.gitignore`](https://github.com/GSA/code-gov-github-metrics/blob/master/.gitignore) and therefore not committed to GitHub). The new data will also be automatically added to the visualizations in the corresponding sheets.
6770

68-
## Contributing
71+
<hr>
72+
73+
# government-wide-repo-metrics
74+
This folder compiles GitHub metrics across all known federal government repos. The most current [list of organizations](https://github.com/github/government.github.com/blob/gh-pages/_data/governments.yml) is maintained by the GitHub Government team.
75+
76+
This portion of the project uses the [GitHub API v3](https://developer.github.com/v3/).
77+
78+
## Getting Started
79+
After cloning the entire repo, move into the repo's directory and folder and install the NPM dependencies:
80+
81+
```
82+
cd code-gov-github-metrics/government-wide-repo-metrics
83+
npm install
84+
```
85+
Next, create a .env file based on the template.
86+
87+
```
88+
cp .env.example .env
89+
```
90+
91+
Now, [create a GitHub Personal Access Token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line#creating-a-token). You may already have this token if you ran the code-gov-repo-metrics. Insert your token into the newly created .env file, replacing `<INSERT YOUR PERSONAL ACCESS TOKEN HERE>`. Don't include any angle brackets (<>), spaces (" "), or quotes ("") in the .env file! (Note: You could copy your .env file to use with either metrics folder.)
92+
93+
## Configuration
94+
95+
The main script will query all GitHub repositories specified in [`agencies-full.json`](https://github.com/GSA/code-gov-github-metrics/blob/master/government-wide-repo-metrics/agencies-full.json). In this file, each agency is listed with associated organizations on GitHub. In most cases, agencies have multiple GitHub organizations with numerous repositories.
96+
97+
## Usage
98+
99+
To generate a new report, run the following command.
100+
101+
```
102+
node index.js
103+
```
104+
105+
Note: To see an output of the API to the terminal as the script is running, run the following command in lieu of the one immediately above.
106+
107+
```
108+
node index.js debug
109+
```
110+
111+
### .csv report
112+
113+
Running this script will create a .csv file titled 'current-date.csv' and will be located in the exports folder.
114+
115+
The report contains a number of metrics about the repositories and definitions of these metrics and can be found in [index.js](https://github.com/GSA/code-gov-github-metrics/blob/master/government-wide-repo-metrics/index.js).
116+
117+
### Saving and visualizing reports
118+
119+
Go to the local file directory (e.g., finder on Mac, explore on Windows) to obtain the CSV file outside your code editor.
120+
121+
<hr>
122+
123+
### Contributing
69124

70125
See [CONTRIBUTING](https://github.com/GSA/code-gov-github-metrics/blob/master/CONTRIBUTING.md)
71126

72-
## License
127+
### License
73128

74129
See [LICENSE](https://github.com/GSA/code-gov-github-metrics/blob/master/LICENSE.md)
75130

76-
## Questions?
131+
### Questions?
77132
If you have questions, please feel free to contact us:
78133
* Open an issue
79134
* [LinkedIn](https://www.linkedin.com/company/code-gov/)

0 commit comments

Comments
 (0)