@credal/actions 0.1.36 → 0.1.38
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.
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const
|
13
|
-
const request_error_1 = require("@octokit/request-error");
|
12
|
+
const octokit_1 = require("octokit");
|
14
13
|
/**
|
15
14
|
* Creates a new branch in a GitHub repository
|
16
15
|
*/
|
@@ -19,10 +18,10 @@ const createBranch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
19
18
|
return { success: false, error: "authToken is required for GitHub API" };
|
20
19
|
}
|
21
20
|
const { repositoryOwner, repositoryName, branchName, baseRefOrHash } = params;
|
22
|
-
const octokit = new
|
21
|
+
const octokit = new octokit_1.Octokit({ auth: authParams.authToken });
|
23
22
|
try {
|
24
23
|
// Get the reference or commit SHA for the base branch or tag
|
25
|
-
const { data: baseRefData } = yield octokit.git
|
24
|
+
const { data: baseRefData } = yield octokit.rest.git
|
26
25
|
.getRef({
|
27
26
|
owner: repositoryOwner,
|
28
27
|
repo: repositoryName,
|
@@ -35,7 +34,7 @@ const createBranch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
35
34
|
}
|
36
35
|
else if (error.status === 404 && /^[a-f0-9]{7,39}$/i.test(baseRefOrHash)) {
|
37
36
|
// If baseRef is a short commit SHA, try to resolve it to a full SHA
|
38
|
-
const { data: commits } = yield octokit.repos.listCommits({
|
37
|
+
const { data: commits } = yield octokit.rest.repos.listCommits({
|
39
38
|
owner: repositoryOwner,
|
40
39
|
repo: repositoryName,
|
41
40
|
sha: baseRefOrHash,
|
@@ -48,7 +47,7 @@ const createBranch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
48
47
|
throw error;
|
49
48
|
}));
|
50
49
|
// Create a new branch from the base reference
|
51
|
-
yield octokit.git.createRef({
|
50
|
+
yield octokit.rest.git.createRef({
|
52
51
|
owner: repositoryOwner,
|
53
52
|
repo: repositoryName,
|
54
53
|
ref: `refs/heads/${branchName}`,
|
@@ -57,7 +56,7 @@ const createBranch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
57
56
|
return { success: true };
|
58
57
|
}
|
59
58
|
catch (error) {
|
60
|
-
if (error instanceof
|
59
|
+
if (error instanceof octokit_1.RequestError) {
|
61
60
|
console.error("GitHub API error:", error.message);
|
62
61
|
return { success: false, error: error.message };
|
63
62
|
}
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const
|
13
|
-
const request_error_1 = require("@octokit/request-error");
|
12
|
+
const octokit_1 = require("octokit");
|
14
13
|
const zod_1 = require("zod");
|
15
14
|
/**
|
16
15
|
* Creates or updates a file in a GitHub repository
|
@@ -20,11 +19,11 @@ const createOrUpdateFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
20
19
|
return { success: false, error: "authToken is required for GitHub API" };
|
21
20
|
}
|
22
21
|
const { repositoryOwner, repositoryName, filePath, branch, fileContent, commitMessage } = params;
|
23
|
-
const octokit = new
|
22
|
+
const octokit = new octokit_1.Octokit({ auth: authParams.authToken });
|
24
23
|
let fileSha = undefined;
|
25
24
|
let operationPreformed = undefined;
|
26
25
|
try {
|
27
|
-
const { data: fileData } = yield octokit.repos.getContent({
|
26
|
+
const { data: fileData } = yield octokit.rest.repos.getContent({
|
28
27
|
owner: repositoryOwner,
|
29
28
|
repo: repositoryName,
|
30
29
|
path: filePath,
|
@@ -41,7 +40,7 @@ const createOrUpdateFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
41
40
|
operationPreformed = "updated";
|
42
41
|
}
|
43
42
|
catch (error) {
|
44
|
-
if (error instanceof
|
43
|
+
if (error instanceof octokit_1.RequestError && error.status === 404) {
|
45
44
|
console.log(`File not found, creating new file.`);
|
46
45
|
operationPreformed = "created";
|
47
46
|
}
|
@@ -50,7 +49,7 @@ const createOrUpdateFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
50
49
|
}
|
51
50
|
}
|
52
51
|
try {
|
53
|
-
const { data: commitData } = yield octokit.repos.createOrUpdateFileContents({
|
52
|
+
const { data: commitData } = yield octokit.rest.repos.createOrUpdateFileContents({
|
54
53
|
owner: repositoryOwner,
|
55
54
|
repo: repositoryName,
|
56
55
|
path: filePath,
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const
|
13
|
-
const request_error_1 = require("@octokit/request-error");
|
12
|
+
const octokit_1 = require("octokit");
|
14
13
|
/**
|
15
14
|
* Creates a pull request in a GitHub repository
|
16
15
|
*/
|
@@ -19,10 +18,10 @@ const createPullRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
19
18
|
return { success: false, error: "authToken is required for GitHub API" };
|
20
19
|
}
|
21
20
|
const { repositoryOwner, repositoryName, head, base, title, description } = params;
|
22
|
-
const octokit = new
|
21
|
+
const octokit = new octokit_1.Octokit({ auth: authParams.authToken });
|
23
22
|
try {
|
24
23
|
// Create the pull request
|
25
|
-
const { data: pullRequestData } = yield octokit.pulls.create({
|
24
|
+
const { data: pullRequestData } = yield octokit.rest.pulls.create({
|
26
25
|
owner: repositoryOwner,
|
27
26
|
repo: repositoryName,
|
28
27
|
head,
|
@@ -37,7 +36,7 @@ const createPullRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
37
36
|
};
|
38
37
|
}
|
39
38
|
catch (error) {
|
40
|
-
if (error instanceof
|
39
|
+
if (error instanceof octokit_1.RequestError) {
|
41
40
|
console.error("GitHub API error:", error.message);
|
42
41
|
return { success: false, error: error.message };
|
43
42
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@credal/actions",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.38",
|
4
4
|
"description": "AI Actions by Credal AI",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -42,7 +42,6 @@
|
|
42
42
|
"@credal/sdk": "^0.0.21",
|
43
43
|
"@mendable/firecrawl-js": "^1.19.0",
|
44
44
|
"@microsoft/microsoft-graph-client": "^3.0.7",
|
45
|
-
"@octokit/rest": "^21.1.1",
|
46
45
|
"@slack/web-api": "^7.8.0",
|
47
46
|
"@types/snowflake-sdk": "^1.6.24",
|
48
47
|
"ajv": "^8.17.1",
|
@@ -52,6 +51,7 @@
|
|
52
51
|
"json-schema-to-zod": "^2.5.0",
|
53
52
|
"jsonwebtoken": "^9.0.2",
|
54
53
|
"mongodb": "^6.13.1",
|
54
|
+
"octokit": "^4.1.2",
|
55
55
|
"resend": "^4.1.2",
|
56
56
|
"snowflake-sdk": "^2.0.2",
|
57
57
|
"ts-node": "^10.9.2",
|