@credal/actions 0.2.58 → 0.2.59
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.
|
@@ -9614,7 +9614,11 @@ export const githubSearchOrganizationDefinition = {
|
|
|
9614
9614
|
},
|
|
9615
9615
|
query: {
|
|
9616
9616
|
type: "string",
|
|
9617
|
-
description: "The query to search for
|
|
9617
|
+
description: "The query to search for within the organization",
|
|
9618
|
+
},
|
|
9619
|
+
repository: {
|
|
9620
|
+
type: "string",
|
|
9621
|
+
description: "The repository to search for data in",
|
|
9618
9622
|
},
|
|
9619
9623
|
},
|
|
9620
9624
|
},
|
|
@@ -6454,12 +6454,15 @@ export type githubSearchRepositoryFunction = ActionFunction<githubSearchReposito
|
|
|
6454
6454
|
export declare const githubSearchOrganizationParamsSchema: z.ZodObject<{
|
|
6455
6455
|
organization: z.ZodString;
|
|
6456
6456
|
query: z.ZodString;
|
|
6457
|
+
repository: z.ZodOptional<z.ZodString>;
|
|
6457
6458
|
}, "strip", z.ZodTypeAny, {
|
|
6458
6459
|
query: string;
|
|
6459
6460
|
organization: string;
|
|
6461
|
+
repository?: string | undefined;
|
|
6460
6462
|
}, {
|
|
6461
6463
|
query: string;
|
|
6462
6464
|
organization: string;
|
|
6465
|
+
repository?: string | undefined;
|
|
6463
6466
|
}>;
|
|
6464
6467
|
export type githubSearchOrganizationParamsType = z.infer<typeof githubSearchOrganizationParamsSchema>;
|
|
6465
6468
|
export declare const githubSearchOrganizationOutputSchema: z.ZodObject<{
|
|
@@ -3385,7 +3385,8 @@ export const githubSearchRepositoryOutputSchema = z.object({
|
|
|
3385
3385
|
});
|
|
3386
3386
|
export const githubSearchOrganizationParamsSchema = z.object({
|
|
3387
3387
|
organization: z.string().describe("The organization to search for data in"),
|
|
3388
|
-
query: z.string().describe("The query to search for
|
|
3388
|
+
query: z.string().describe("The query to search for within the organization"),
|
|
3389
|
+
repository: z.string().describe("The repository to search for data in").optional(),
|
|
3389
3390
|
});
|
|
3390
3391
|
export const githubSearchOrganizationOutputSchema = z.object({
|
|
3391
3392
|
code: z
|
|
@@ -22,10 +22,11 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
22
22
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
23
23
|
}
|
|
24
24
|
const octokit = new Octokit({ auth: authParams.authToken });
|
|
25
|
-
const { organization, query } = params;
|
|
25
|
+
const { organization, query, repository } = params;
|
|
26
|
+
const searchScope = repository ? `repo:${organization}/${repository}` : `org:${organization}`;
|
|
26
27
|
// Search CODE with text match metadata
|
|
27
28
|
const codeResultsResponse = yield octokit.rest.search.code({
|
|
28
|
-
q: `${query} in:file,path
|
|
29
|
+
q: `${query} in:file,path ${searchScope}`,
|
|
29
30
|
text_match: true,
|
|
30
31
|
headers: {
|
|
31
32
|
accept: "application/vnd.github.v3.text-match+json",
|
|
@@ -51,7 +52,7 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
51
52
|
}));
|
|
52
53
|
// Search COMMITS
|
|
53
54
|
const commitResults = yield octokit.rest.search.commits({
|
|
54
|
-
q: `${query}
|
|
55
|
+
q: `${query} ${searchScope}`,
|
|
55
56
|
headers: {
|
|
56
57
|
accept: "application/vnd.github.cloak-preview+json",
|
|
57
58
|
},
|
|
@@ -85,7 +86,7 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
85
86
|
});
|
|
86
87
|
// Search Issues and PRs
|
|
87
88
|
const issueResults = yield octokit.rest.search.issuesAndPullRequests({
|
|
88
|
-
q: `${query}
|
|
89
|
+
q: `${query} ${searchScope} (is:issue OR is:pull-request)`,
|
|
89
90
|
advanced_search: "true",
|
|
90
91
|
});
|
|
91
92
|
const prItems = issueResults.data.items.filter(item => item.pull_request).slice(0, MAX_ISSUES_OR_PRS);
|
|
@@ -93,13 +94,12 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
93
94
|
const prFiles = yield Promise.all(prItems.map((item) => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
95
|
// Each item has a 'repository_url' like: "https://api.github.com/repos/ORG/REPO"
|
|
95
96
|
const repoUrlParts = item.repository_url.split("/");
|
|
96
|
-
const
|
|
97
|
-
const repo = repoUrlParts[repoUrlParts.length - 1];
|
|
97
|
+
const repo = repository !== null && repository !== void 0 ? repository : repoUrlParts[repoUrlParts.length - 1];
|
|
98
98
|
try {
|
|
99
|
-
return yield octokit.rest.pulls.listFiles({ owner, repo, pull_number: item.number });
|
|
99
|
+
return yield octokit.rest.pulls.listFiles({ owner: organization, repo: repo, pull_number: item.number });
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
|
-
console.error(`Error fetching PR files for PR ${item.number} in ${
|
|
102
|
+
console.error(`Error fetching PR files for PR ${item.number} in ${organization}/${repo}:`, error);
|
|
103
103
|
return { data: [] };
|
|
104
104
|
}
|
|
105
105
|
})));
|