volunteer-contributions-fetch 2.3.1 → 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +1 -1
- package/.github/workflows/release.yml +2 -2
- package/.github/workflows/test.yml +13 -13
- package/.prettierignore +4 -0
- package/README.md +71 -71
- package/fixtures/community-portal.js +184 -172
- package/lib/bugzilla.js +21 -12
- package/lib/bugzilla.test.js +59 -48
- package/lib/community-portal.js +20 -14
- package/lib/community-portal.test.js +30 -18
- package/lib/discourse.js +7 -6
- package/lib/discourse.test.js +31 -28
- package/lib/fetch.js +25 -14
- package/lib/fetch.test.js +34 -17
- package/lib/github.js +77 -35
- package/lib/github.test.js +544 -351
- package/lib/wiki.js +27 -41
- package/lib/wiki.test.js +11 -10
- package/package.json +16 -8
package/.eslintrc
CHANGED
|
@@ -9,8 +9,8 @@ jobs:
|
|
|
9
9
|
release:
|
|
10
10
|
runs-on: ubuntu-22.04
|
|
11
11
|
steps:
|
|
12
|
-
- uses: actions/checkout@
|
|
13
|
-
- uses: actions/setup-node@
|
|
12
|
+
- uses: actions/checkout@v3
|
|
13
|
+
- uses: actions/setup-node@v3
|
|
14
14
|
with:
|
|
15
15
|
node-version: 16
|
|
16
16
|
- run: npm ci
|
|
@@ -6,16 +6,16 @@ jobs:
|
|
|
6
6
|
build:
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
steps:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
- uses: actions/checkout@v3
|
|
10
|
+
with:
|
|
11
|
+
submodules: 'recursive'
|
|
12
|
+
- name: Use Node.js 16
|
|
13
|
+
uses: actions/setup-node@v3
|
|
14
|
+
with:
|
|
15
|
+
node-version: 16
|
|
16
|
+
- name: Install Dependencies
|
|
17
|
+
run: npm ci
|
|
18
|
+
- name: Linting
|
|
19
|
+
run: npm run eslint
|
|
20
|
+
- name: Test
|
|
21
|
+
run: npm test
|
package/.prettierignore
ADDED
package/README.md
CHANGED
|
@@ -8,22 +8,22 @@ This library fetches contributions from several different sources and saves them
|
|
|
8
8
|
|
|
9
9
|
Currently the following sources are supported. Feel free to contribute a PR if you'd like to support another source!
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
- GitHub
|
|
12
|
+
- Issues created
|
|
13
|
+
- Comments on issues
|
|
14
|
+
- PRs
|
|
15
|
+
- PR Reviews
|
|
16
|
+
- Bugzilla
|
|
17
|
+
- Bug reported
|
|
18
|
+
- Bug commented on
|
|
19
|
+
- MediaWiki
|
|
20
|
+
- Page edited
|
|
21
|
+
- Discourse
|
|
22
|
+
- Topic created
|
|
23
|
+
- Post created
|
|
24
|
+
- Mozilla Community Portal
|
|
25
|
+
- Participated in event
|
|
26
|
+
- Participated in campaign
|
|
27
27
|
|
|
28
28
|
Each of the sources can be enabled separately. See the configuration section below.
|
|
29
29
|
|
|
@@ -31,16 +31,16 @@ Each of the sources can be enabled separately. See the configuration section bel
|
|
|
31
31
|
|
|
32
32
|
The following sources are planned:
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
- Phabricator
|
|
35
|
+
- Revision created
|
|
36
|
+
- Revision updated
|
|
37
37
|
|
|
38
38
|
### Possible future sources
|
|
39
39
|
|
|
40
40
|
The following sources would be interesting for (at least) Mozilla contributors, however they do not expose an activity API endpoint to easily gather information for a certain user.
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
- support.mozilla.org
|
|
43
|
+
- Pontoon
|
|
44
44
|
|
|
45
45
|
## Usage
|
|
46
46
|
|
|
@@ -66,7 +66,7 @@ You can configure the different providers with a config you pass into the `fetch
|
|
|
66
66
|
|
|
67
67
|
Additionally to the configuration file, we also require some environment variables to be set:
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
- `GITHUB_TOKEN` with a GitHub token, if the GitHub source is enabled
|
|
70
70
|
|
|
71
71
|
While these tokens could potentially also be included the config, we want to make it hard to mistakenly publish secrets within code.
|
|
72
72
|
|
|
@@ -77,9 +77,9 @@ This section documents all the possible configuration values. For examples see t
|
|
|
77
77
|
#### General
|
|
78
78
|
|
|
79
79
|
| Field | Data Type | Required | Default | Description |
|
|
80
|
-
|
|
80
|
+
| ----------------- | --------- | -------- | ------- | -------------------------------------------------- |
|
|
81
81
|
| `outputFile` | string | Yes | - | Path to contributions output file |
|
|
82
|
-
| `bugzilla` | Object | No | - | Bugzilla configuration options (see below)
|
|
82
|
+
| `bugzilla` | Object | No | - | Bugzilla configuration options (see below) |
|
|
83
83
|
| `communityPortal` | Object | No | - | Community Portal configuration options (see below) |
|
|
84
84
|
| `discourse` | Object | No | - | Discourse configuration options (see below) |
|
|
85
85
|
| `github` | Object | No | - | GitHub configuration options (see below) |
|
|
@@ -87,20 +87,20 @@ This section documents all the possible configuration values. For examples see t
|
|
|
87
87
|
|
|
88
88
|
#### Bugzilla
|
|
89
89
|
|
|
90
|
-
| Field | Data Type | Required | Default | Description
|
|
91
|
-
|
|
92
|
-
| `enabled` | boolean | Yes | - | Indicates whether this data source is enabled. Alternatively you can also leave off the `mediaWiki` object entirely.
|
|
93
|
-
| `baseUrl` | string | Yes | - | API base url without trailing slash (for example: `https://bugzilla.mozilla.org`)
|
|
94
|
-
| `username` | string | Yes | - | Username on MediaWiki
|
|
95
|
-
| `stopDate` | string | Yes | - | `new Date()` parseable string containing a date of possibly earliest contribution to track
|
|
96
|
-
| `types` | Object | No | - | Object containing the different labels below
|
|
97
|
-
| `types.createdType` | string | No | Created a Bug Report | Label for entries related to having report a bug/enhancement.
|
|
98
|
-
| `types.commentedType` | string | No | Commented on a Bug Report | Label for entries related to having commented on a bug/enhancement.
|
|
90
|
+
| Field | Data Type | Required | Default | Description |
|
|
91
|
+
| --------------------- | --------- | -------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
92
|
+
| `enabled` | boolean | Yes | - | Indicates whether this data source is enabled. Alternatively you can also leave off the `mediaWiki` object entirely. |
|
|
93
|
+
| `baseUrl` | string | Yes | - | API base url without trailing slash (for example: `https://bugzilla.mozilla.org`) |
|
|
94
|
+
| `username` | string | Yes | - | Username on MediaWiki |
|
|
95
|
+
| `stopDate` | string | Yes | - | `new Date()` parseable string containing a date of possibly earliest contribution to track |
|
|
96
|
+
| `types` | Object | No | - | Object containing the different labels below |
|
|
97
|
+
| `types.createdType` | string | No | Created a Bug Report | Label for entries related to having report a bug/enhancement. |
|
|
98
|
+
| `types.commentedType` | string | No | Commented on a Bug Report | Label for entries related to having commented on a bug/enhancement. |
|
|
99
99
|
|
|
100
100
|
#### Community Portal
|
|
101
101
|
|
|
102
102
|
| Field | Data Type | Required | Default | Description |
|
|
103
|
-
|
|
103
|
+
| ------------------- | --------- | -------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
104
104
|
| `enabled` | boolean | Yes | - | Indicates whether this data source is enabled. Alternatively you can also leave off the `communityPortal` object entirely. |
|
|
105
105
|
| `baseUrl` | string | Yes | - | Community Portal base url without trailing slash |
|
|
106
106
|
| `username` | string | Yes | - | Username on the Community Portal |
|
|
@@ -109,48 +109,48 @@ This section documents all the possible configuration values. For examples see t
|
|
|
109
109
|
|
|
110
110
|
#### Discourse
|
|
111
111
|
|
|
112
|
-
| Field
|
|
113
|
-
|
|
114
|
-
| `enabled`
|
|
115
|
-
| `baseUrl`
|
|
116
|
-
| `username`
|
|
117
|
-
| `topicType`
|
|
118
|
-
| `postType`
|
|
112
|
+
| Field | Data Type | Required | Default | Description |
|
|
113
|
+
| ----------- | --------- | -------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
114
|
+
| `enabled` | boolean | Yes | - | Indicates whether this data source is enabled. Alternatively you can also leave off the `discourse` object entirely. |
|
|
115
|
+
| `baseUrl` | string | Yes | - | API base url without trailing slash |
|
|
116
|
+
| `username` | string | Yes | - | Username on Discourse |
|
|
117
|
+
| `topicType` | string | No | Created Discourse Topic | Label for entries related to having created a new topic. |
|
|
118
|
+
| `postType` | string | No | Posted on Discourse Topic | Label for entries related to having posted on an existing topic. |
|
|
119
119
|
|
|
120
120
|
#### GitHub
|
|
121
121
|
|
|
122
|
-
| Field | Data Type | Required | Default
|
|
123
|
-
|
|
124
|
-
| `enabled` | boolean | Yes | -
|
|
125
|
-
| `allowPrivate` | boolean | No | false
|
|
126
|
-
| `commentsEnabled` | boolean | No | true
|
|
127
|
-
| `commitsEnabled` | boolean | No | true
|
|
128
|
-
| `issuesEnabled` | boolean | No | true
|
|
129
|
-
| `reviewsEnabled` | boolean | No | true
|
|
130
|
-
| `username` | string | Yes | -
|
|
131
|
-
| `stopDate` | string | Yes | -
|
|
132
|
-
| `filter` | string | Yes | -
|
|
133
|
-
| `types` | Object | No | - | Object containing the different labels below
|
|
134
|
-
| `types.commit` | string | No | GitHub Commit | Label for entries related to GitHub commits
|
|
135
|
-
| `types.privateCommit` | string | No | Commit in private repository | Label for entries related to private GitHub commits
|
|
136
|
-
| `types.createdPR` | string | No | Created PR | Label for entries related to opening GitHub PRs
|
|
137
|
-
| `types.createdIssue` | string | No | Created Issue Report | Label for entries related to creating GitHub issues
|
|
138
|
-
| `types.commented` | string | No | Commented on an Issue | Label for entries related to commenting on an issue
|
|
139
|
-
| `types.commentedPR` | string | No | Commented on a Pull Request | Label for entries related to commenting on a GitHub PR (review)
|
|
140
|
-
| `types.approvedPR` | string | No | Approved a Pull Request | Label for entries related to approving a GitHub PR
|
|
141
|
-
| `types.changesRequestedPR` | string | No | Requested changes on a Pull Request | Label for entries related to requesting changes on a GitHub PR
|
|
142
|
-
| `types.reviewedPR` | string | No | Reviewed a Pull Request | Label for entries related to reviewing a GitHub PR (fallback)
|
|
143
|
-
| `delayMsPerRequest` | number | No | 2000 | Delay between each request to GitHub. You might hit rate limiting if you set this lower than default.
|
|
122
|
+
| Field | Data Type | Required | Default | Description |
|
|
123
|
+
| -------------------------- | --------- | -------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
124
|
+
| `enabled` | boolean | Yes | - | Indicates whether this data source is enabled. Alternatively you can also leave off the `github` object entirely. |
|
|
125
|
+
| `allowPrivate` | boolean | No | false | Indicates whether fetching from private repositories is allowed. If not set, the script will throw if you pass a `GITHUB_TOKEN` with private repo scope. In most cases you will not want to have a token with private scope as you do not want to leak any private information in your contribution overview. Please think twice before enabling this config. |
|
|
126
|
+
| `commentsEnabled` | boolean | No | true | Indicates whether fetching comments is enabled. |
|
|
127
|
+
| `commitsEnabled` | boolean | No | true | Indicates whether fetching commits is enabled. |
|
|
128
|
+
| `issuesEnabled` | boolean | No | true | Indicates whether fetching issues is enabled. |
|
|
129
|
+
| `reviewsEnabled` | boolean | No | true | Indicates whether fetching reviews is enabled. |
|
|
130
|
+
| `username` | string | Yes | - | Username on GitHub |
|
|
131
|
+
| `stopDate` | string | Yes | - | `new Date()` parseable string containing a date of possibly earliest contribution to track |
|
|
132
|
+
| `filter` | string | Yes | - | Regex to apply to each entry to filter for organization/repo names. For example: `^mozilla` to only include orgs and repos that start with "mozilla". |
|
|
133
|
+
| `types` | Object | No | - | Object containing the different labels below |
|
|
134
|
+
| `types.commit` | string | No | GitHub Commit | Label for entries related to GitHub commits |
|
|
135
|
+
| `types.privateCommit` | string | No | Commit in private repository | Label for entries related to private GitHub commits |
|
|
136
|
+
| `types.createdPR` | string | No | Created PR | Label for entries related to opening GitHub PRs |
|
|
137
|
+
| `types.createdIssue` | string | No | Created Issue Report | Label for entries related to creating GitHub issues |
|
|
138
|
+
| `types.commented` | string | No | Commented on an Issue | Label for entries related to commenting on an issue |
|
|
139
|
+
| `types.commentedPR` | string | No | Commented on a Pull Request | Label for entries related to commenting on a GitHub PR (review) |
|
|
140
|
+
| `types.approvedPR` | string | No | Approved a Pull Request | Label for entries related to approving a GitHub PR |
|
|
141
|
+
| `types.changesRequestedPR` | string | No | Requested changes on a Pull Request | Label for entries related to requesting changes on a GitHub PR |
|
|
142
|
+
| `types.reviewedPR` | string | No | Reviewed a Pull Request | Label for entries related to reviewing a GitHub PR (fallback) |
|
|
143
|
+
| `delayMsPerRequest` | number | No | 2000 | Delay between each request to GitHub. You might hit rate limiting if you set this lower than default. |
|
|
144
144
|
|
|
145
145
|
#### MediaWiki
|
|
146
146
|
|
|
147
|
-
| Field
|
|
148
|
-
|
|
149
|
-
| `enabled`
|
|
150
|
-
| `baseUrl`
|
|
151
|
-
| `username`
|
|
152
|
-
| `editType`
|
|
153
|
-
| `stopDate`
|
|
147
|
+
| Field | Data Type | Required | Default | Description |
|
|
148
|
+
| ---------- | --------- | -------- | --------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
149
|
+
| `enabled` | boolean | Yes | - | Indicates whether this data source is enabled. Alternatively you can also leave off the `mediaWiki` object entirely. |
|
|
150
|
+
| `baseUrl` | string | Yes | - | API base url without trailing slash |
|
|
151
|
+
| `username` | string | Yes | - | Username on MediaWiki |
|
|
152
|
+
| `editType` | string | No | Wiki Edit | Label for entries related to having edited an article. |
|
|
153
|
+
| `stopDate` | string | Yes | - | `new Date()` parseable string containing a date of possibly earliest contribution to track |
|
|
154
154
|
|
|
155
155
|
### Sample configuration
|
|
156
156
|
|
|
@@ -198,7 +198,7 @@ const config = {
|
|
|
198
198
|
approvedPR: 'Approved a Pull Request',
|
|
199
199
|
changesRequestedPR: 'Requested changes on a Pull Request',
|
|
200
200
|
reviewedPR: 'Reviewed a Pull Request',
|
|
201
|
-
}
|
|
201
|
+
},
|
|
202
202
|
},
|
|
203
203
|
};
|
|
204
204
|
```
|