@oss-autopilot/core 1.5.0 → 1.6.0
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/dist/cli.bundle.cjs +18 -18
- package/dist/core/github-stats.d.ts +0 -4
- package/dist/core/github-stats.js +3 -12
- package/dist/core/pr-monitor.js +2 -11
- package/package.json +1 -1
|
@@ -34,8 +34,6 @@ export declare function fetchUserClosedPRCounts(octokit: Octokit, githubUsername
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function fetchRecentlyClosedPRs(octokit: Octokit, config: {
|
|
36
36
|
githubUsername: string;
|
|
37
|
-
excludeRepos?: string[];
|
|
38
|
-
excludeOrgs?: string[];
|
|
39
37
|
}, days?: number): Promise<ClosedPR[]>;
|
|
40
38
|
/**
|
|
41
39
|
* Fetch PRs merged in the last N days.
|
|
@@ -43,8 +41,6 @@ export declare function fetchRecentlyClosedPRs(octokit: Octokit, config: {
|
|
|
43
41
|
*/
|
|
44
42
|
export declare function fetchRecentlyMergedPRs(octokit: Octokit, config: {
|
|
45
43
|
githubUsername: string;
|
|
46
|
-
excludeRepos?: string[];
|
|
47
|
-
excludeOrgs?: string[];
|
|
48
44
|
}, days?: number): Promise<MergedPR[]>;
|
|
49
45
|
/**
|
|
50
46
|
* Fetch merged PRs since a watermark date for incremental storage.
|
|
@@ -194,19 +194,10 @@ async function fetchRecentPRs(octokit, config, query, label, days, mapItem) {
|
|
|
194
194
|
warn(MODULE, `Could not parse GitHub URL from API response: ${item.html_url}`);
|
|
195
195
|
continue;
|
|
196
196
|
}
|
|
197
|
-
const repo = `${parsed.owner}/${parsed.repo}`;
|
|
198
197
|
// Skip own repos
|
|
199
198
|
if (isOwnRepo(parsed.owner, config.githubUsername))
|
|
200
199
|
continue;
|
|
201
|
-
|
|
202
|
-
if (config.excludeRepos?.includes(repo)) {
|
|
203
|
-
debug(MODULE, `Skipping excluded repo: ${repo}`);
|
|
204
|
-
continue;
|
|
205
|
-
}
|
|
206
|
-
if (config.excludeOrgs?.some((org) => org.toLowerCase() === parsed.owner.toLowerCase())) {
|
|
207
|
-
debug(MODULE, `Skipping excluded org: ${parsed.owner}`);
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
200
|
+
const repo = `${parsed.owner}/${parsed.repo}`;
|
|
210
201
|
results.push(mapItem(item, { owner: parsed.owner, repo, number: parsed.number }));
|
|
211
202
|
}
|
|
212
203
|
debug(MODULE, `Found ${results.length} recently ${label} PRs`);
|
|
@@ -217,7 +208,7 @@ async function fetchRecentPRs(octokit, config, query, label, days, mapItem) {
|
|
|
217
208
|
* Returns lightweight ClosedPR objects for surfacing in the daily digest.
|
|
218
209
|
*/
|
|
219
210
|
export async function fetchRecentlyClosedPRs(octokit, config, days = 7) {
|
|
220
|
-
return fetchRecentPRs(octokit, config, 'is:pr is:closed is:unmerged author:{username} closed:>={since}', 'closed', days, (item, { repo, number }) => ({
|
|
211
|
+
return fetchRecentPRs(octokit, config, 'is:pr is:closed is:unmerged is:public author:{username} closed:>={since}', 'closed', days, (item, { repo, number }) => ({
|
|
221
212
|
url: item.html_url,
|
|
222
213
|
repo,
|
|
223
214
|
number,
|
|
@@ -230,7 +221,7 @@ export async function fetchRecentlyClosedPRs(octokit, config, days = 7) {
|
|
|
230
221
|
* Returns lightweight MergedPR objects for surfacing as wins in the dashboard.
|
|
231
222
|
*/
|
|
232
223
|
export async function fetchRecentlyMergedPRs(octokit, config, days = 7) {
|
|
233
|
-
return fetchRecentPRs(octokit, config, 'is:pr is:merged author:{username} merged:>={since}', 'merged', days, (item, { repo, number }) => {
|
|
224
|
+
return fetchRecentPRs(octokit, config, 'is:pr is:merged is:public author:{username} merged:>={since}', 'merged', days, (item, { repo, number }) => {
|
|
234
225
|
const mergedAt = item.pull_request?.merged_at;
|
|
235
226
|
if (!mergedAt) {
|
|
236
227
|
warn(MODULE, `merged_at missing for merged PR ${item.html_url}${item.closed_at ? ', falling back to closed_at' : ', no date available'}`);
|
package/dist/core/pr-monitor.js
CHANGED
|
@@ -88,7 +88,7 @@ export class PRMonitor {
|
|
|
88
88
|
let page = 1;
|
|
89
89
|
const perPage = 100;
|
|
90
90
|
const firstPage = await this.octokit.search.issuesAndPullRequests({
|
|
91
|
-
q: `is:pr is:open author:${config.githubUsername}`,
|
|
91
|
+
q: `is:pr is:open is:public author:${config.githubUsername}`,
|
|
92
92
|
sort: 'updated',
|
|
93
93
|
order: 'desc',
|
|
94
94
|
per_page: perPage,
|
|
@@ -102,7 +102,7 @@ export class PRMonitor {
|
|
|
102
102
|
while (page < totalPages) {
|
|
103
103
|
page++;
|
|
104
104
|
const nextPage = await this.octokit.search.issuesAndPullRequests({
|
|
105
|
-
q: `is:pr is:open author:${config.githubUsername}`,
|
|
105
|
+
q: `is:pr is:open is:public author:${config.githubUsername}`,
|
|
106
106
|
sort: 'updated',
|
|
107
107
|
order: 'desc',
|
|
108
108
|
per_page: perPage,
|
|
@@ -124,15 +124,6 @@ export class PRMonitor {
|
|
|
124
124
|
}
|
|
125
125
|
if (isOwnRepo(parsed.owner, config.githubUsername))
|
|
126
126
|
return false;
|
|
127
|
-
// Exclude configured repos and orgs (#792)
|
|
128
|
-
if (config.excludeRepos.includes(`${parsed.owner}/${parsed.repo}`)) {
|
|
129
|
-
debug('pr-monitor', `Skipping excluded repo: ${parsed.owner}/${parsed.repo}`);
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
if (config.excludeOrgs?.some((org) => org.toLowerCase() === parsed.owner.toLowerCase())) {
|
|
133
|
-
debug('pr-monitor', `Skipping excluded org: ${parsed.owner}`);
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
127
|
return true;
|
|
137
128
|
});
|
|
138
129
|
debug('pr-monitor', `Filtered to ${filteredItems.length} PRs after excluding own repos`);
|