You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 23, 2021. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+71-16
Original file line number
Diff line number
Diff 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.
3
2
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.
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.
15
18
16
19
```
17
-
cd code-gov-github-metrics
20
+
cd code-gov-github-metrics/code-gov-repo-metrics
18
21
npm install
19
22
```
20
23
21
-
Next, create a .env file based on the template:
24
+
Next, create a .env file based on the template.
22
25
23
26
```
24
27
cp .env.example .env
25
28
```
26
29
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!
28
31
29
32
## Configuration
30
33
31
34
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.
32
35
33
36
## Usage
34
37
35
-
To generate a new report, run a command like the one below:
38
+
To generate a report, run the following command.
36
39
37
40
```
38
41
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
54
57
55
58
### Saving and visualizing reports
56
59
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:
58
61
59
62
* In the Google Sheet, click on `File > Import`
60
63
* Click `Upload`
@@ -65,15 +68,67 @@ For the code.gov team, reports should be run monthly on a regular schedule to ke
65
68
66
69
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.
67
70
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
69
124
70
125
See [CONTRIBUTING](https://github.com/GSA/code-gov-github-metrics/blob/master/CONTRIBUTING.md)
71
126
72
-
## License
127
+
###License
73
128
74
129
See [LICENSE](https://github.com/GSA/code-gov-github-metrics/blob/master/LICENSE.md)
75
130
76
-
## Questions?
131
+
###Questions?
77
132
If you have questions, please feel free to contact us:
0 commit comments