@tahminator/pipeline 1.0.72 → 1.0.73-beta.35856f4d
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/gh/client.d.ts +1 -0
- package/dist/gh/client.js +4 -1
- package/dist/gh/pr/index.d.ts +16 -1
- package/dist/gh/pr/index.js +25 -1
- package/package.json +1 -1
package/dist/gh/client.d.ts
CHANGED
|
@@ -39,4 +39,5 @@ export declare class GitHubClient {
|
|
|
39
39
|
outputToGithubOutput(...args: Parameters<GitHubOutputManager["outputToGithubOutput"]>): Promise<void>;
|
|
40
40
|
updateK8sTagWithPR(...args: Parameters<GitHubPRManager["updateK8sTagWithPR"]>): Promise<void>;
|
|
41
41
|
sendPrMessage(...args: Parameters<GitHubPRManager["sendPrMessage"]>): Promise<void>;
|
|
42
|
+
approvePr(...args: Parameters<GitHubPRManager["approvePr"]>): Promise<void>;
|
|
42
43
|
}
|
package/dist/gh/client.js
CHANGED
|
@@ -14,7 +14,7 @@ export class GitHubClient {
|
|
|
14
14
|
this.isExplicitToken = isExplicitToken;
|
|
15
15
|
this.tagManager = new GitHubTagManager(this.client, this.isExplicitToken);
|
|
16
16
|
this.outputManager = new GitHubOutputManager();
|
|
17
|
-
this.prManager = new GitHubPRManager(this.client);
|
|
17
|
+
this.prManager = new GitHubPRManager(this.client, this.isExplicitToken);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* @note `appId` can be `Client ID` or `App ID`. Hover over `appId` for more details.
|
|
@@ -68,4 +68,7 @@ export class GitHubClient {
|
|
|
68
68
|
sendPrMessage(...args) {
|
|
69
69
|
return this.prManager.sendPrMessage(...args);
|
|
70
70
|
}
|
|
71
|
+
approvePr(...args) {
|
|
72
|
+
return this.prManager.approvePr(...args);
|
|
73
|
+
}
|
|
71
74
|
}
|
package/dist/gh/pr/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type { Octokit } from "@octokit/rest";
|
|
|
2
2
|
import type { Environment, OwnerString, RepoString } from "../../types";
|
|
3
3
|
export declare class GitHubPRManager {
|
|
4
4
|
private readonly client;
|
|
5
|
-
|
|
5
|
+
private readonly isExplicitToken;
|
|
6
|
+
constructor(client: Octokit, isExplicitToken: boolean);
|
|
7
|
+
private checkToken;
|
|
6
8
|
/**
|
|
7
9
|
*
|
|
8
10
|
* update k8s manifest repo with new tag version.
|
|
@@ -40,4 +42,17 @@ export declare class GitHubPRManager {
|
|
|
40
42
|
repository: string;
|
|
41
43
|
message: string;
|
|
42
44
|
}): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Approves the given pull request.
|
|
47
|
+
*
|
|
48
|
+
* @note requires a token belonging to a user/app distinct from the PR author,
|
|
49
|
+
* since GitHub does not allow self-approval. As such, it is highly recommended to
|
|
50
|
+
* just use an app identity instead.
|
|
51
|
+
*/
|
|
52
|
+
approvePr({ prId, owner, repository, message, }: {
|
|
53
|
+
prId: number;
|
|
54
|
+
owner: string;
|
|
55
|
+
repository: string;
|
|
56
|
+
message?: string;
|
|
57
|
+
}): Promise<void>;
|
|
43
58
|
}
|
package/dist/gh/pr/index.js
CHANGED
|
@@ -3,8 +3,15 @@ import { Utils } from "../../utils";
|
|
|
3
3
|
import { kustomizeSchema } from "./schema";
|
|
4
4
|
export class GitHubPRManager {
|
|
5
5
|
client;
|
|
6
|
-
|
|
6
|
+
isExplicitToken;
|
|
7
|
+
constructor(client, isExplicitToken) {
|
|
7
8
|
this.client = client;
|
|
9
|
+
this.isExplicitToken = isExplicitToken;
|
|
10
|
+
}
|
|
11
|
+
checkToken() {
|
|
12
|
+
if (!this.isExplicitToken) {
|
|
13
|
+
throw new Error("You must pass in an explicit GitHub token for this operation. You may either use a PAT or a GitHub App Token");
|
|
14
|
+
}
|
|
8
15
|
}
|
|
9
16
|
/**
|
|
10
17
|
*
|
|
@@ -106,4 +113,21 @@ export class GitHubPRManager {
|
|
|
106
113
|
body: message,
|
|
107
114
|
});
|
|
108
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Approves the given pull request.
|
|
118
|
+
*
|
|
119
|
+
* @note requires a token belonging to a user/app distinct from the PR author,
|
|
120
|
+
* since GitHub does not allow self-approval. As such, it is highly recommended to
|
|
121
|
+
* just use an app identity instead.
|
|
122
|
+
*/
|
|
123
|
+
async approvePr({ prId, owner, repository, message, }) {
|
|
124
|
+
this.checkToken();
|
|
125
|
+
await this.client.rest.pulls.createReview({
|
|
126
|
+
pull_number: prId,
|
|
127
|
+
owner,
|
|
128
|
+
repo: repository,
|
|
129
|
+
event: "APPROVE",
|
|
130
|
+
body: message,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
109
133
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "Tahmid Ahmed",
|
|
5
5
|
"description": "A collection of Bun shell scripts that can be re-used in various CICD pipelines.",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.73-beta.35856f4d",
|
|
7
7
|
"repository": {
|
|
8
8
|
"url": "git+https://github.com/tahminator/pipeline.git"
|
|
9
9
|
},
|