@skuba-lib/api 0.0.0 → 0.1.0-skuba-lib-api-20250925050503
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/LICENSE +21 -0
- package/README.md +8 -0
- package/buildkite/package.json +5 -0
- package/git/package.json +5 -0
- package/github/package.json +5 -0
- package/lib/buildkite/index.d.mts +2 -0
- package/lib/buildkite/index.d.ts +2 -0
- package/lib/buildkite/index.js +6 -0
- package/lib/buildkite/index.mjs +5 -0
- package/lib/buildkite-BXHjSY0I.js +67 -0
- package/lib/buildkite-DSHpKA4z.mjs +50 -0
- package/lib/chunk-CZCtuq8p.mjs +37 -0
- package/lib/chunk-odGzh3W-.js +58 -0
- package/lib/exec-B2akdw0z.js +17597 -0
- package/lib/exec-p0gJ30UO.mjs +17580 -0
- package/lib/git/index.d.mts +2 -0
- package/lib/git/index.d.ts +2 -0
- package/lib/git/index.js +14 -0
- package/lib/git/index.mjs +3 -0
- package/lib/git-DDfcZdbm.mjs +379 -0
- package/lib/git-DVG_dHiI.js +474 -0
- package/lib/github/index.d.mts +3 -0
- package/lib/github/index.d.ts +3 -0
- package/lib/github/index.js +12 -0
- package/lib/github/index.mjs +5 -0
- package/lib/github-B4auwKt7.js +310 -0
- package/lib/github-vycKoVtK.mjs +269 -0
- package/lib/index-1eEu26nG.d.ts +255 -0
- package/lib/index-9i8gHTGu.d.mts +38 -0
- package/lib/index-B91wXiwr.d.ts +278 -0
- package/lib/index-CfnlMf_4.d.ts +39 -0
- package/lib/index-Cl--YMPq.d.mts +255 -0
- package/lib/index-DNXQKEza.d.mts +278 -0
- package/lib/index-DiqTDK1U.d.mts +39 -0
- package/lib/index-MmnRaakr.d.ts +38 -0
- package/lib/index.d.mts +5 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +31 -0
- package/lib/index.mjs +8 -0
- package/lib/logging-6TTEX4U4.js +2217 -0
- package/lib/logging-Dr8kuQ_p.mjs +2194 -0
- package/lib/net/index.d.mts +2 -0
- package/lib/net/index.d.ts +2 -0
- package/lib/net/index.js +5 -0
- package/lib/net/index.mjs +5 -0
- package/lib/net-BteSPzmU.js +86 -0
- package/lib/net-ByUFe0qv.mjs +75 -0
- package/net/package.json +5 -0
- package/package.json +58 -8
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { ChangedFile } from "./index-B91wXiwr.js";
|
|
2
|
+
import { Endpoints } from "@octokit/types";
|
|
3
|
+
import { Octokit } from "@octokit/rest";
|
|
4
|
+
|
|
5
|
+
//#region src/github/checkRun.d.ts
|
|
6
|
+
type Output = NonNullable<Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']['output']>;
|
|
7
|
+
type Annotation = NonNullable<Output['annotations']>[number];
|
|
8
|
+
/**
|
|
9
|
+
* {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run}
|
|
10
|
+
*/
|
|
11
|
+
interface CreateCheckRunParameters {
|
|
12
|
+
/**
|
|
13
|
+
* Adds information from your analysis to specific lines of code.
|
|
14
|
+
* Annotations are visible on GitHub in the **Checks** and **Files changed**
|
|
15
|
+
* tab of the pull request.
|
|
16
|
+
*/
|
|
17
|
+
annotations: Annotation[];
|
|
18
|
+
/**
|
|
19
|
+
* The final conclusion of the check.
|
|
20
|
+
*/
|
|
21
|
+
conclusion: 'failure' | 'success';
|
|
22
|
+
/**
|
|
23
|
+
* The name of the check. For example, "code-coverage".
|
|
24
|
+
*/
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* The summary of the check run. This parameter supports Markdown.
|
|
28
|
+
*/
|
|
29
|
+
summary: string;
|
|
30
|
+
/**
|
|
31
|
+
* The details of the check run. This parameter supports Markdown.
|
|
32
|
+
*/
|
|
33
|
+
text?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The title of the check run.
|
|
36
|
+
*/
|
|
37
|
+
title: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Asynchronously creates a GitHub check run with annotations.
|
|
41
|
+
*
|
|
42
|
+
* The first 50 `annotations` are written in full to GitHub.
|
|
43
|
+
*
|
|
44
|
+
* A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission
|
|
45
|
+
* must be present on the environment.
|
|
46
|
+
*/
|
|
47
|
+
declare const createCheckRun: ({
|
|
48
|
+
annotations,
|
|
49
|
+
conclusion,
|
|
50
|
+
name,
|
|
51
|
+
summary,
|
|
52
|
+
text,
|
|
53
|
+
title
|
|
54
|
+
}: CreateCheckRunParameters) => Promise<void>;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/github/environment.d.ts
|
|
57
|
+
/**
|
|
58
|
+
* Returns the name of the build as seen in GitHub status checks.
|
|
59
|
+
*
|
|
60
|
+
* This is driven off of environment variables and falls back to `Build`.
|
|
61
|
+
*/
|
|
62
|
+
declare const buildNameFromEnvironment: (env?: NodeJS.ProcessEnv) => string;
|
|
63
|
+
/**
|
|
64
|
+
* Whether GitHub API interactions should be enabled.
|
|
65
|
+
*
|
|
66
|
+
* This checks environment variables to see if the code is executing in a CI
|
|
67
|
+
* environment and has access to a GitHub API token.
|
|
68
|
+
*/
|
|
69
|
+
declare const enabledFromEnvironment: (env?: NodeJS.ProcessEnv) => boolean;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/github/pullRequest.d.ts
|
|
72
|
+
interface GetPullRequestParameters {
|
|
73
|
+
/**
|
|
74
|
+
* A preconstructed Octokit client to interact with GitHub's APIs.
|
|
75
|
+
*
|
|
76
|
+
* A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be
|
|
77
|
+
* present on the environment if this is not provided.
|
|
78
|
+
*/
|
|
79
|
+
client?: Octokit;
|
|
80
|
+
env?: Record<string, string | undefined>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets the number of the current pull request.
|
|
84
|
+
*
|
|
85
|
+
* This tries to extract the pull request from common CI environment variables,
|
|
86
|
+
* and falls back to querying the GitHub Repos API for the latest pull request
|
|
87
|
+
* associated with the head commit. An error is thrown if there are no
|
|
88
|
+
* associated pull requests, or if they are all closed or locked.
|
|
89
|
+
*/
|
|
90
|
+
declare const getPullRequestNumber: (params?: GetPullRequestParameters) => Promise<number>;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/github/issueComment.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* https://docs.github.com/en/rest/reference/issues#create-an-issue-comment
|
|
95
|
+
*/
|
|
96
|
+
interface PutIssueCommentParameters {
|
|
97
|
+
/**
|
|
98
|
+
* The body of the issue comment.
|
|
99
|
+
*
|
|
100
|
+
* An explicit `null` value will remove the comment, if `internalId` is provided.
|
|
101
|
+
*/
|
|
102
|
+
body: string | null;
|
|
103
|
+
/**
|
|
104
|
+
* An internal identifier for the issue comment.
|
|
105
|
+
*
|
|
106
|
+
* This can be used to scope a given `put` to a particular comment, preventing
|
|
107
|
+
* it from clobbering other comments from the same bot or user.
|
|
108
|
+
*
|
|
109
|
+
* The identifier is embedded as hidden content in the comment body.
|
|
110
|
+
*/
|
|
111
|
+
internalId?: string;
|
|
112
|
+
env?: Record<string, string | undefined>;
|
|
113
|
+
/**
|
|
114
|
+
* The number that identifies the GitHub issue.
|
|
115
|
+
*
|
|
116
|
+
* If this is not provided, the number will be inferred from the GitHub Repos
|
|
117
|
+
* API by finding the latest pull request associated with the head commit.
|
|
118
|
+
*
|
|
119
|
+
* https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit
|
|
120
|
+
*/
|
|
121
|
+
issueNumber?: number;
|
|
122
|
+
/**
|
|
123
|
+
* The ID of authenticated bot or user that is putting the issue comment.
|
|
124
|
+
*
|
|
125
|
+
* This drives our `put` behaviour, which tries to locate and edit an existing
|
|
126
|
+
* comment before creating a new one. If this is not provided, the ID will be
|
|
127
|
+
* inferred from the GitHub Users API.
|
|
128
|
+
*
|
|
129
|
+
* https://docs.github.com/en/rest/reference/users#get-the-authenticated-user
|
|
130
|
+
*
|
|
131
|
+
* If you're at SEEK and using BuildAgency's GitHub API integration, you may
|
|
132
|
+
* use `'seek-build-agency'` as an optimisation to skip the user lookup.
|
|
133
|
+
*
|
|
134
|
+
* https://api.github.com/users/buildagencygitapitoken[bot]
|
|
135
|
+
*/
|
|
136
|
+
userId?: number | 'seek-build-agency';
|
|
137
|
+
}
|
|
138
|
+
interface IssueComment {
|
|
139
|
+
id: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Asynchronously creates or updates a GitHub issue comment.
|
|
143
|
+
*
|
|
144
|
+
* This emulates `put` behaviour by overwriting the first existing comment by
|
|
145
|
+
* the same author on the issue, enabling use cases like a persistent bot
|
|
146
|
+
* comment at the top of the pull request that reflects the current status of a
|
|
147
|
+
* CI check.
|
|
148
|
+
*
|
|
149
|
+
* A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be present
|
|
150
|
+
* on the environment.
|
|
151
|
+
*/
|
|
152
|
+
declare const putIssueComment: (params: PutIssueCommentParameters) => Promise<IssueComment | null>;
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/github/push.d.ts
|
|
155
|
+
interface UploadAllFileChangesParams {
|
|
156
|
+
dir: string;
|
|
157
|
+
/**
|
|
158
|
+
* The branch name
|
|
159
|
+
*/
|
|
160
|
+
branch: string;
|
|
161
|
+
/**
|
|
162
|
+
* The headline of the commit message
|
|
163
|
+
*/
|
|
164
|
+
messageHeadline: string;
|
|
165
|
+
/**
|
|
166
|
+
* File changes to exclude from the upload.
|
|
167
|
+
*
|
|
168
|
+
* Defaults to `[]` (no exclusions).
|
|
169
|
+
*/
|
|
170
|
+
ignore?: ChangedFile[];
|
|
171
|
+
/**
|
|
172
|
+
* The body of the commit message
|
|
173
|
+
*/
|
|
174
|
+
messageBody?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Updates the local Git repository to match the new remote branch state
|
|
177
|
+
*/
|
|
178
|
+
updateLocal?: boolean;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Retrieves all file changes from the local Git repository using
|
|
182
|
+
* `getChangedFiles`, then uploads the changes to a specified GitHub branch
|
|
183
|
+
* using `uploadFileChanges`.
|
|
184
|
+
*
|
|
185
|
+
* Returns the commit ID, or `undefined` if there are no changes to commit.
|
|
186
|
+
*
|
|
187
|
+
* The file changes will appear as verified commits on GitHub.
|
|
188
|
+
*
|
|
189
|
+
* This will not update the local Git repository unless `updateLocal` is
|
|
190
|
+
* specified.
|
|
191
|
+
*/
|
|
192
|
+
declare const uploadAllFileChanges: ({
|
|
193
|
+
branch,
|
|
194
|
+
dir,
|
|
195
|
+
messageHeadline,
|
|
196
|
+
ignore,
|
|
197
|
+
messageBody,
|
|
198
|
+
updateLocal
|
|
199
|
+
}: UploadAllFileChangesParams) => Promise<string | undefined>;
|
|
200
|
+
interface FileAddition {
|
|
201
|
+
contents: unknown;
|
|
202
|
+
path: string;
|
|
203
|
+
}
|
|
204
|
+
interface FileDeletion {
|
|
205
|
+
path: string;
|
|
206
|
+
}
|
|
207
|
+
interface FileChanges {
|
|
208
|
+
additions: FileAddition[];
|
|
209
|
+
deletions: FileDeletion[];
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Takes a list of `ChangedFiles`, reads them from the file system, and maps
|
|
213
|
+
* them to GitHub GraphQL `FileChanges`.
|
|
214
|
+
*
|
|
215
|
+
* https://docs.github.com/en/graphql/reference/input-objects#filechanges
|
|
216
|
+
*/
|
|
217
|
+
declare const readFileChanges: (dir: string, changedFiles: ChangedFile[]) => Promise<FileChanges>;
|
|
218
|
+
interface UploadFileChangesParams {
|
|
219
|
+
dir: string;
|
|
220
|
+
/**
|
|
221
|
+
* The branch name
|
|
222
|
+
*/
|
|
223
|
+
branch: string;
|
|
224
|
+
/**
|
|
225
|
+
* The headline of the commit message
|
|
226
|
+
*/
|
|
227
|
+
messageHeadline: string;
|
|
228
|
+
/**
|
|
229
|
+
* The body of the commit message
|
|
230
|
+
*/
|
|
231
|
+
messageBody?: string;
|
|
232
|
+
/**
|
|
233
|
+
* File additions and deletions
|
|
234
|
+
*/
|
|
235
|
+
fileChanges: FileChanges;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Uploads file changes from the local workspace to a specified GitHub branch.
|
|
239
|
+
*
|
|
240
|
+
* The file changes will appear as verified commits on GitHub.
|
|
241
|
+
*
|
|
242
|
+
* This will not update the local Git repository.
|
|
243
|
+
*/
|
|
244
|
+
declare const uploadFileChanges: ({
|
|
245
|
+
dir,
|
|
246
|
+
branch,
|
|
247
|
+
messageHeadline,
|
|
248
|
+
messageBody,
|
|
249
|
+
fileChanges
|
|
250
|
+
}: UploadFileChangesParams) => Promise<string>;
|
|
251
|
+
declare namespace index_d_exports {
|
|
252
|
+
export { Annotation, buildNameFromEnvironment, createCheckRun, enabledFromEnvironment, getPullRequestNumber, putIssueComment, readFileChanges, uploadAllFileChanges, uploadFileChanges };
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
export { type Annotation, buildNameFromEnvironment, createCheckRun, enabledFromEnvironment, getPullRequestNumber, index_d_exports, putIssueComment, readFileChanges, uploadAllFileChanges, uploadFileChanges };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/net/socket.d.ts
|
|
2
|
+
interface SocketAddress {
|
|
3
|
+
host: string;
|
|
4
|
+
port: number;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/net/waitFor.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Wait for a resource to start listening on a socket address.
|
|
10
|
+
*
|
|
11
|
+
* The socket is polled on an interval until it accepts a connection or the
|
|
12
|
+
* `timeout` is reached.
|
|
13
|
+
*/
|
|
14
|
+
declare const waitFor: ({
|
|
15
|
+
host,
|
|
16
|
+
port,
|
|
17
|
+
resolveCompose,
|
|
18
|
+
timeout
|
|
19
|
+
}: {
|
|
20
|
+
host?: string;
|
|
21
|
+
port: number;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to treat the `host` and `port` arguments as a private Docker
|
|
24
|
+
* Compose network address and to resolve them to a public local address.
|
|
25
|
+
*
|
|
26
|
+
* This is typically:
|
|
27
|
+
*
|
|
28
|
+
* - Enabled locally, when the application is running directly on the machine
|
|
29
|
+
* - Disabled in CI, when running in a container on the Docker Compose network
|
|
30
|
+
*/
|
|
31
|
+
resolveCompose?: boolean;
|
|
32
|
+
timeout?: number;
|
|
33
|
+
}) => Promise<SocketAddress>;
|
|
34
|
+
declare namespace index_d_exports {
|
|
35
|
+
export { waitFor };
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { index_d_exports as index_d_exports$1, waitFor as waitFor$1 };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
//#region src/git/commit.d.ts
|
|
2
|
+
interface Identity {
|
|
3
|
+
email?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
}
|
|
6
|
+
interface CommitParameters {
|
|
7
|
+
author?: Identity;
|
|
8
|
+
committer?: Identity;
|
|
9
|
+
dir: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Writes a commit to the local Git repository.
|
|
14
|
+
*/
|
|
15
|
+
declare const commit: ({
|
|
16
|
+
author,
|
|
17
|
+
committer,
|
|
18
|
+
dir,
|
|
19
|
+
message
|
|
20
|
+
}: CommitParameters) => Promise<string>;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/git/getChangedFiles.d.ts
|
|
23
|
+
type ChangedFileState = 'added' | 'modified' | 'deleted';
|
|
24
|
+
interface ChangedFile {
|
|
25
|
+
path: string;
|
|
26
|
+
state: ChangedFileState;
|
|
27
|
+
}
|
|
28
|
+
interface ChangedFilesParameters {
|
|
29
|
+
dir: string;
|
|
30
|
+
/**
|
|
31
|
+
* File changes to exclude from the result.
|
|
32
|
+
*
|
|
33
|
+
* Defaults to `[]` (no exclusions).
|
|
34
|
+
*/
|
|
35
|
+
ignore?: ChangedFile[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns all the files which have been added, modified or deleted in the
|
|
39
|
+
* working directory of the local Git repository since the last commit.
|
|
40
|
+
*/
|
|
41
|
+
declare const getChangedFiles: ({
|
|
42
|
+
dir,
|
|
43
|
+
ignore
|
|
44
|
+
}: ChangedFilesParameters) => Promise<ChangedFile[]>;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/git/commitAllChanges.d.ts
|
|
47
|
+
interface CommitAllParameters {
|
|
48
|
+
dir: string;
|
|
49
|
+
message: string;
|
|
50
|
+
author?: Identity;
|
|
51
|
+
committer?: Identity;
|
|
52
|
+
/**
|
|
53
|
+
* File changes to exclude from the commit.
|
|
54
|
+
*
|
|
55
|
+
* Defaults to `[]` (no exclusions).
|
|
56
|
+
*/
|
|
57
|
+
ignore?: ChangedFile[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Stages all changes and writes a commit to the local Git repository.
|
|
61
|
+
*/
|
|
62
|
+
declare const commitAllChanges: ({
|
|
63
|
+
dir,
|
|
64
|
+
message,
|
|
65
|
+
author,
|
|
66
|
+
committer,
|
|
67
|
+
ignore
|
|
68
|
+
}: CommitAllParameters) => Promise<string | undefined>;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/git/currentBranch.d.ts
|
|
71
|
+
interface CurrentBranchParameters {
|
|
72
|
+
dir?: string;
|
|
73
|
+
env?: Record<string, string | undefined>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Tries to return a Git branch name from CI environment variables, falling back
|
|
77
|
+
* to the local Git repository when the current working `dir` is supplied.
|
|
78
|
+
*/
|
|
79
|
+
declare const currentBranch: ({
|
|
80
|
+
dir,
|
|
81
|
+
env
|
|
82
|
+
}?: CurrentBranchParameters) => Promise<string | undefined>;
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/git/findRoot.d.ts
|
|
85
|
+
interface FindRootParameters {
|
|
86
|
+
dir: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns the first Git root directory encountered walking up from the provided
|
|
90
|
+
* `dir`.
|
|
91
|
+
*/
|
|
92
|
+
declare const findRoot: ({
|
|
93
|
+
dir
|
|
94
|
+
}: FindRootParameters) => Promise<string | null>;
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/git/log.d.ts
|
|
97
|
+
interface GetHeadCommitParameters {
|
|
98
|
+
dir: string;
|
|
99
|
+
env?: Record<string, string | undefined>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets the object ID of the head commit.
|
|
103
|
+
*
|
|
104
|
+
* This tries to extract the commit ID from common CI environment variables,
|
|
105
|
+
* and falls back to the local Git repository log.
|
|
106
|
+
*/
|
|
107
|
+
declare const getHeadCommitId: ({
|
|
108
|
+
dir,
|
|
109
|
+
env
|
|
110
|
+
}: GetHeadCommitParameters) => Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Gets the message of the head commit.
|
|
113
|
+
*
|
|
114
|
+
* This tries to extract the message from common CI environment variables,
|
|
115
|
+
* and falls back to the local Git repository log.
|
|
116
|
+
*/
|
|
117
|
+
declare const getHeadCommitMessage: ({
|
|
118
|
+
dir,
|
|
119
|
+
env
|
|
120
|
+
}: GetHeadCommitParameters) => Promise<string>;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/git/remote.d.ts
|
|
123
|
+
interface GetOwnerAndRepoParameters {
|
|
124
|
+
dir: string;
|
|
125
|
+
env?: Record<string, string | undefined>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Extracts the owner and repository names from CI environment variables,
|
|
129
|
+
* falling back to local Git remotes.
|
|
130
|
+
*
|
|
131
|
+
* Currently, only GitHub repository URLs are supported:
|
|
132
|
+
*
|
|
133
|
+
* ```console
|
|
134
|
+
* git@github.com:seek-oss/skuba.git
|
|
135
|
+
* https://github.com/seek-oss/skuba.git
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
declare const getOwnerAndRepo: ({
|
|
139
|
+
dir,
|
|
140
|
+
env
|
|
141
|
+
}: GetOwnerAndRepoParameters) => Promise<{
|
|
142
|
+
owner: string;
|
|
143
|
+
repo: string;
|
|
144
|
+
}>;
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/git/push.d.ts
|
|
147
|
+
/**
|
|
148
|
+
* Use a GitHub app token to auth the Git push.
|
|
149
|
+
*
|
|
150
|
+
* This defaults to the `GITHUB_API_TOKEN` and `GITHUB_TOKEN` environment
|
|
151
|
+
* variables if `token` is not provided.
|
|
152
|
+
*/
|
|
153
|
+
interface GitHubAppAuth$1 {
|
|
154
|
+
type: 'gitHubApp';
|
|
155
|
+
token?: string;
|
|
156
|
+
}
|
|
157
|
+
interface PushParameters {
|
|
158
|
+
/**
|
|
159
|
+
* The auth mechanism for the push.
|
|
160
|
+
*
|
|
161
|
+
* Currently, only GitHub app tokens are supported.
|
|
162
|
+
*/
|
|
163
|
+
auth: GitHubAppAuth$1;
|
|
164
|
+
dir: string;
|
|
165
|
+
/**
|
|
166
|
+
* The reference to push to the remote.
|
|
167
|
+
*
|
|
168
|
+
* This may be a commit, branch or tag in the local repository.
|
|
169
|
+
*/
|
|
170
|
+
ref: string;
|
|
171
|
+
remote?: string;
|
|
172
|
+
/**
|
|
173
|
+
* The destination branch or tag on the remote.
|
|
174
|
+
*
|
|
175
|
+
* This defaults to `ref`.
|
|
176
|
+
*/
|
|
177
|
+
remoteRef?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Forcefully override any conflicts.
|
|
180
|
+
*
|
|
181
|
+
* This defaults to `false`.
|
|
182
|
+
*/
|
|
183
|
+
force?: boolean;
|
|
184
|
+
}
|
|
185
|
+
interface PushResult {
|
|
186
|
+
ok: boolean;
|
|
187
|
+
error: string | null;
|
|
188
|
+
refs: Record<string, {
|
|
189
|
+
ok: boolean;
|
|
190
|
+
error: string;
|
|
191
|
+
}>;
|
|
192
|
+
headers?: Record<string, string> | undefined;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Pushes the specified `ref` from the local Git repository to a remote.
|
|
196
|
+
*/
|
|
197
|
+
declare const push: ({
|
|
198
|
+
auth,
|
|
199
|
+
dir,
|
|
200
|
+
ref,
|
|
201
|
+
remote,
|
|
202
|
+
remoteRef,
|
|
203
|
+
force
|
|
204
|
+
}: PushParameters) => Promise<PushResult>;
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/git/pull.d.ts
|
|
207
|
+
/**
|
|
208
|
+
* Use a GitHub app token to auth the Git push.
|
|
209
|
+
*
|
|
210
|
+
* This defaults to the `GITHUB_API_TOKEN` and `GITHUB_TOKEN` environment
|
|
211
|
+
* variables if `token` is not provided.
|
|
212
|
+
*/
|
|
213
|
+
interface GitHubAppAuth {
|
|
214
|
+
type: 'gitHubApp';
|
|
215
|
+
token?: string;
|
|
216
|
+
}
|
|
217
|
+
interface PullParameters {
|
|
218
|
+
/**
|
|
219
|
+
* The auth mechanism for the push.
|
|
220
|
+
*
|
|
221
|
+
* Currently, only GitHub app tokens are supported.
|
|
222
|
+
*/
|
|
223
|
+
auth: GitHubAppAuth;
|
|
224
|
+
dir: string;
|
|
225
|
+
/**
|
|
226
|
+
* The local branch to fast forward.
|
|
227
|
+
*/
|
|
228
|
+
ref: string;
|
|
229
|
+
remote?: string;
|
|
230
|
+
/**
|
|
231
|
+
* The branch or tag on the remote to reference.
|
|
232
|
+
*
|
|
233
|
+
* This defaults to `ref`.
|
|
234
|
+
*/
|
|
235
|
+
remoteRef?: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Fast forwards the specified `ref` on the local Git repository to match the remote branch.
|
|
239
|
+
*/
|
|
240
|
+
declare const fastForwardBranch: ({
|
|
241
|
+
auth,
|
|
242
|
+
dir,
|
|
243
|
+
ref,
|
|
244
|
+
remote,
|
|
245
|
+
remoteRef
|
|
246
|
+
}: PullParameters) => Promise<void>;
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/git/reset.d.ts
|
|
249
|
+
interface ResetParameters {
|
|
250
|
+
dir: string;
|
|
251
|
+
branch: string;
|
|
252
|
+
commitId: string;
|
|
253
|
+
hard?: boolean;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Resets the specified branch in the local Git repository to a particular
|
|
257
|
+
* commit.
|
|
258
|
+
*/
|
|
259
|
+
declare const reset: ({
|
|
260
|
+
dir,
|
|
261
|
+
branch,
|
|
262
|
+
commitId,
|
|
263
|
+
hard
|
|
264
|
+
}: ResetParameters) => Promise<void>;
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/git/isFileGitIgnored.d.ts
|
|
267
|
+
declare const isFileGitIgnored: ({
|
|
268
|
+
absolutePath,
|
|
269
|
+
gitRoot
|
|
270
|
+
}: {
|
|
271
|
+
absolutePath: string;
|
|
272
|
+
gitRoot: string;
|
|
273
|
+
}) => Promise<boolean>;
|
|
274
|
+
declare namespace index_d_exports {
|
|
275
|
+
export { ChangedFile, commit, commitAllChanges, currentBranch, fastForwardBranch, findRoot, getChangedFiles, getHeadCommitId, getHeadCommitMessage, getOwnerAndRepo, isFileGitIgnored, push, reset };
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
export { type ChangedFile, commit, commitAllChanges, currentBranch, fastForwardBranch, findRoot, getChangedFiles, getHeadCommitId, getHeadCommitMessage, getOwnerAndRepo, index_d_exports as index_d_exports$1, isFileGitIgnored, push, reset };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/buildkite/annotate.d.ts
|
|
2
|
+
type AnnotationStyle = 'success' | 'info' | 'warning' | 'error';
|
|
3
|
+
interface AnnotationOptions {
|
|
4
|
+
context?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Scopes an annotation's context to the Buildkite step ID.
|
|
7
|
+
*
|
|
8
|
+
* This lets you emit distinct annotations per step, and only takes effect if
|
|
9
|
+
* the `BUILDKITE_STEP_ID` environment variable is present.
|
|
10
|
+
*/
|
|
11
|
+
scopeContextToStep?: boolean;
|
|
12
|
+
style?: AnnotationStyle;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Asynchronously uploads a Buildkite annotation.
|
|
16
|
+
*
|
|
17
|
+
* If the following environment variables are not present,
|
|
18
|
+
* the function will silently return without attempting to annotate:
|
|
19
|
+
*
|
|
20
|
+
* - `BUILDKITE`
|
|
21
|
+
* - `BUILDKITE_AGENT_ACCESS_TOKEN`
|
|
22
|
+
* - `BUILDKITE_JOB_ID`
|
|
23
|
+
*
|
|
24
|
+
* The `buildkite-agent` binary must also be on your `PATH`.
|
|
25
|
+
*/
|
|
26
|
+
declare const annotate: (markdown: string, opts?: AnnotationOptions) => Promise<void>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/buildkite/md.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
declare const md: {
|
|
33
|
+
terminal: (code: string) => string;
|
|
34
|
+
};
|
|
35
|
+
declare namespace index_d_exports {
|
|
36
|
+
export { AnnotationStyle, annotate, md };
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { type AnnotationStyle, annotate, index_d_exports as index_d_exports$2, md };
|