@generacy-ai/generacy-plugin-github-actions 0.0.0-preview-20260304013206
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 +191 -0
- package/dist/client.d.ts +46 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +109 -0
- package/dist/client.js.map +1 -0
- package/dist/events/emitter.d.ts +40 -0
- package/dist/events/emitter.d.ts.map +1 -0
- package/dist/events/emitter.js +104 -0
- package/dist/events/emitter.js.map +1 -0
- package/dist/events/types.d.ts +61 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +48 -0
- package/dist/events/types.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/operations/artifacts.d.ts +46 -0
- package/dist/operations/artifacts.d.ts.map +1 -0
- package/dist/operations/artifacts.js +166 -0
- package/dist/operations/artifacts.js.map +1 -0
- package/dist/operations/check-runs.d.ts +58 -0
- package/dist/operations/check-runs.d.ts.map +1 -0
- package/dist/operations/check-runs.js +188 -0
- package/dist/operations/check-runs.js.map +1 -0
- package/dist/operations/jobs.d.ts +35 -0
- package/dist/operations/jobs.d.ts.map +1 -0
- package/dist/operations/jobs.js +134 -0
- package/dist/operations/jobs.js.map +1 -0
- package/dist/operations/runs.d.ts +49 -0
- package/dist/operations/runs.d.ts.map +1 -0
- package/dist/operations/runs.js +164 -0
- package/dist/operations/runs.js.map +1 -0
- package/dist/operations/workflows.d.ts +32 -0
- package/dist/operations/workflows.d.ts.map +1 -0
- package/dist/operations/workflows.js +138 -0
- package/dist/operations/workflows.js.map +1 -0
- package/dist/plugin.d.ts +254 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +471 -0
- package/dist/plugin.js.map +1 -0
- package/dist/polling/status-poller.d.ts +58 -0
- package/dist/polling/status-poller.d.ts.map +1 -0
- package/dist/polling/status-poller.js +167 -0
- package/dist/polling/status-poller.js.map +1 -0
- package/dist/polling/types.d.ts +54 -0
- package/dist/polling/types.d.ts.map +1 -0
- package/dist/polling/types.js +21 -0
- package/dist/polling/types.js.map +1 -0
- package/dist/types/artifacts.d.ts +49 -0
- package/dist/types/artifacts.d.ts.map +1 -0
- package/dist/types/artifacts.js +22 -0
- package/dist/types/artifacts.js.map +1 -0
- package/dist/types/check-runs.d.ts +123 -0
- package/dist/types/check-runs.d.ts.map +1 -0
- package/dist/types/check-runs.js +13 -0
- package/dist/types/check-runs.js.map +1 -0
- package/dist/types/config.d.ts +131 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +40 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/events.d.ts +69 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +19 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/jobs.d.ts +71 -0
- package/dist/types/jobs.d.ts.map +1 -0
- package/dist/types/jobs.js +19 -0
- package/dist/types/jobs.js.map +1 -0
- package/dist/types/workflows.d.ts +101 -0
- package/dist/types/workflows.d.ts.map +1 -0
- package/dist/types/workflows.js +19 -0
- package/dist/types/workflows.js.map +1 -0
- package/dist/utils/errors.d.ts +77 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +122 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/validation.d.ts +74 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +86 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2026 The Generacy AI Authors
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Octokit } from '@octokit/rest';
|
|
2
|
+
import type { GitHubActionsConfig } from './types/config.js';
|
|
3
|
+
/**
|
|
4
|
+
* GitHub API client wrapper for GitHub Actions operations
|
|
5
|
+
*/
|
|
6
|
+
export declare class GitHubClient {
|
|
7
|
+
private readonly octokit;
|
|
8
|
+
private readonly owner;
|
|
9
|
+
private readonly repo;
|
|
10
|
+
constructor(config: GitHubActionsConfig);
|
|
11
|
+
/**
|
|
12
|
+
* Get the repository owner
|
|
13
|
+
*/
|
|
14
|
+
getOwner(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the repository name
|
|
17
|
+
*/
|
|
18
|
+
getRepo(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get the underlying Octokit instance
|
|
21
|
+
*/
|
|
22
|
+
getOctokit(): Octokit;
|
|
23
|
+
/**
|
|
24
|
+
* Execute a GitHub API request with rate limit handling
|
|
25
|
+
*/
|
|
26
|
+
request<T>(fn: (octokit: Octokit) => Promise<{
|
|
27
|
+
data: T;
|
|
28
|
+
}>): Promise<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Execute a GitHub API request that returns raw data (like log downloads)
|
|
31
|
+
*/
|
|
32
|
+
requestRaw<T>(fn: (octokit: Octokit) => Promise<T>): Promise<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if an error is a rate limit error
|
|
35
|
+
*/
|
|
36
|
+
private isRateLimitError;
|
|
37
|
+
/**
|
|
38
|
+
* Extract rate limit reset time from error headers
|
|
39
|
+
*/
|
|
40
|
+
private extractRateLimitReset;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a new GitHub client
|
|
44
|
+
*/
|
|
45
|
+
export declare function createClient(config: GitHubActionsConfig): GitHubClient;
|
|
46
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAElB,MAAM,EAAE,mBAAmB;IAevC;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,UAAU,IAAI,OAAO;IAIrB;;OAEG;IACG,OAAO,CAAC,CAAC,EACb,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,GAC7C,OAAO,CAAC,CAAC,CAAC;IAab;;OAEG;IACG,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAYrE;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAqB9B;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,YAAY,CAEtE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Octokit } from '@octokit/rest';
|
|
2
|
+
import { RateLimitError, ConfigurationError } from './utils/errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* GitHub API client wrapper for GitHub Actions operations
|
|
5
|
+
*/
|
|
6
|
+
export class GitHubClient {
|
|
7
|
+
octokit;
|
|
8
|
+
owner;
|
|
9
|
+
repo;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
if (!config.owner || !config.repo || !config.token) {
|
|
12
|
+
throw new ConfigurationError('owner, repo, and token are required in configuration');
|
|
13
|
+
}
|
|
14
|
+
this.owner = config.owner;
|
|
15
|
+
this.repo = config.repo;
|
|
16
|
+
this.octokit = new Octokit({
|
|
17
|
+
auth: config.token,
|
|
18
|
+
userAgent: '@generacy-ai/generacy-plugin-github-actions',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the repository owner
|
|
23
|
+
*/
|
|
24
|
+
getOwner() {
|
|
25
|
+
return this.owner;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the repository name
|
|
29
|
+
*/
|
|
30
|
+
getRepo() {
|
|
31
|
+
return this.repo;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get the underlying Octokit instance
|
|
35
|
+
*/
|
|
36
|
+
getOctokit() {
|
|
37
|
+
return this.octokit;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Execute a GitHub API request with rate limit handling
|
|
41
|
+
*/
|
|
42
|
+
async request(fn) {
|
|
43
|
+
try {
|
|
44
|
+
const response = await fn(this.octokit);
|
|
45
|
+
return response.data;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (this.isRateLimitError(error)) {
|
|
49
|
+
const resetAt = this.extractRateLimitReset(error);
|
|
50
|
+
throw new RateLimitError(resetAt, error);
|
|
51
|
+
}
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Execute a GitHub API request that returns raw data (like log downloads)
|
|
57
|
+
*/
|
|
58
|
+
async requestRaw(fn) {
|
|
59
|
+
try {
|
|
60
|
+
return await fn(this.octokit);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (this.isRateLimitError(error)) {
|
|
64
|
+
const resetAt = this.extractRateLimitReset(error);
|
|
65
|
+
throw new RateLimitError(resetAt, error);
|
|
66
|
+
}
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Check if an error is a rate limit error
|
|
72
|
+
*/
|
|
73
|
+
isRateLimitError(error) {
|
|
74
|
+
if (error && typeof error === 'object' && 'status' in error) {
|
|
75
|
+
const statusError = error;
|
|
76
|
+
return statusError.status === 403 || statusError.status === 429;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Extract rate limit reset time from error headers
|
|
82
|
+
*/
|
|
83
|
+
extractRateLimitReset(error) {
|
|
84
|
+
if (error &&
|
|
85
|
+
typeof error === 'object' &&
|
|
86
|
+
'response' in error &&
|
|
87
|
+
error.response &&
|
|
88
|
+
typeof error.response === 'object' &&
|
|
89
|
+
'headers' in error.response) {
|
|
90
|
+
const headers = error.response.headers;
|
|
91
|
+
const resetHeader = headers['x-ratelimit-reset'];
|
|
92
|
+
if (resetHeader) {
|
|
93
|
+
const resetTimestamp = parseInt(resetHeader, 10);
|
|
94
|
+
if (!isNaN(resetTimestamp)) {
|
|
95
|
+
return new Date(resetTimestamp * 1000);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Default to 60 seconds from now if we can't determine the reset time
|
|
100
|
+
return new Date(Date.now() + 60000);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a new GitHub client
|
|
105
|
+
*/
|
|
106
|
+
export function createClient(config) {
|
|
107
|
+
return new GitHubClient(config);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,YAAY;IACN,OAAO,CAAU;IACjB,KAAK,CAAS;IACd,IAAI,CAAS;IAE9B,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,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B;IACtD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { EventBus } from './types.js';
|
|
2
|
+
import type { WorkflowRun } from '../types/workflows.js';
|
|
3
|
+
import type { CheckRun } from '../types/check-runs.js';
|
|
4
|
+
import type { Job } from '../types/jobs.js';
|
|
5
|
+
/**
|
|
6
|
+
* Event emitter for GitHub Actions plugin events
|
|
7
|
+
*/
|
|
8
|
+
export declare class WorkflowEventEmitter {
|
|
9
|
+
private readonly eventBus;
|
|
10
|
+
constructor(eventBus: EventBus);
|
|
11
|
+
/**
|
|
12
|
+
* Emit a workflow completed event
|
|
13
|
+
*/
|
|
14
|
+
emitWorkflowCompleted(run: WorkflowRun): void;
|
|
15
|
+
/**
|
|
16
|
+
* Emit a workflow failed event
|
|
17
|
+
*/
|
|
18
|
+
emitWorkflowFailed(run: WorkflowRun, failedJobs?: Job[]): void;
|
|
19
|
+
/**
|
|
20
|
+
* Emit a check run completed event
|
|
21
|
+
*/
|
|
22
|
+
emitCheckRunCompleted(check: CheckRun): void;
|
|
23
|
+
/**
|
|
24
|
+
* Emit an event based on workflow run status
|
|
25
|
+
*/
|
|
26
|
+
emitForWorkflowRun(run: WorkflowRun, failedJobs?: Job[]): void;
|
|
27
|
+
/**
|
|
28
|
+
* Calculate workflow duration in milliseconds
|
|
29
|
+
*/
|
|
30
|
+
private calculateDuration;
|
|
31
|
+
/**
|
|
32
|
+
* Get a descriptive failure reason
|
|
33
|
+
*/
|
|
34
|
+
private getFailureReason;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a workflow event emitter
|
|
38
|
+
*/
|
|
39
|
+
export declare function createEventEmitter(eventBus: EventBus): WorkflowEventEmitter;
|
|
40
|
+
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/events/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAO5C;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;gBAExB,QAAQ,EAAE,QAAQ;IAI9B;;OAEG;IACH,qBAAqB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;IAe7C;;OAEG;IACH,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,UAAU,GAAE,GAAG,EAAO,GAAG,IAAI;IAalE;;OAEG;IACH,qBAAqB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAY5C;;OAEG;IACH,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,UAAU,GAAE,GAAG,EAAO,GAAG,IAAI;IAmBlE;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAazB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,oBAAoB,CAE3E"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event emitter for GitHub Actions plugin events
|
|
3
|
+
*/
|
|
4
|
+
export class WorkflowEventEmitter {
|
|
5
|
+
eventBus;
|
|
6
|
+
constructor(eventBus) {
|
|
7
|
+
this.eventBus = eventBus;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Emit a workflow completed event
|
|
11
|
+
*/
|
|
12
|
+
emitWorkflowCompleted(run) {
|
|
13
|
+
const duration = this.calculateDuration(run);
|
|
14
|
+
const event = {
|
|
15
|
+
type: 'workflow.completed',
|
|
16
|
+
runId: run.id,
|
|
17
|
+
workflow: run.path,
|
|
18
|
+
conclusion: run.conclusion,
|
|
19
|
+
duration,
|
|
20
|
+
url: run.html_url,
|
|
21
|
+
};
|
|
22
|
+
this.eventBus.emit('workflow.completed', event);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Emit a workflow failed event
|
|
26
|
+
*/
|
|
27
|
+
emitWorkflowFailed(run, failedJobs = []) {
|
|
28
|
+
const event = {
|
|
29
|
+
type: 'workflow.failed',
|
|
30
|
+
runId: run.id,
|
|
31
|
+
workflow: run.path,
|
|
32
|
+
error: this.getFailureReason(run, failedJobs),
|
|
33
|
+
failedJobs: failedJobs.map((job) => job.name),
|
|
34
|
+
url: run.html_url,
|
|
35
|
+
};
|
|
36
|
+
this.eventBus.emit('workflow.failed', event);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Emit a check run completed event
|
|
40
|
+
*/
|
|
41
|
+
emitCheckRunCompleted(check) {
|
|
42
|
+
const event = {
|
|
43
|
+
type: 'check_run.completed',
|
|
44
|
+
checkRunId: check.id,
|
|
45
|
+
name: check.name,
|
|
46
|
+
conclusion: check.conclusion,
|
|
47
|
+
headSha: check.head_sha,
|
|
48
|
+
};
|
|
49
|
+
this.eventBus.emit('check_run.completed', event);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Emit an event based on workflow run status
|
|
53
|
+
*/
|
|
54
|
+
emitForWorkflowRun(run, failedJobs = []) {
|
|
55
|
+
if (run.status !== 'completed') {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (run.conclusion === 'success') {
|
|
59
|
+
this.emitWorkflowCompleted(run);
|
|
60
|
+
}
|
|
61
|
+
else if (run.conclusion === 'failure' ||
|
|
62
|
+
run.conclusion === 'timed_out' ||
|
|
63
|
+
run.conclusion === 'cancelled') {
|
|
64
|
+
this.emitWorkflowFailed(run, failedJobs);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// For neutral, skipped, action_required - emit completed
|
|
68
|
+
this.emitWorkflowCompleted(run);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Calculate workflow duration in milliseconds
|
|
73
|
+
*/
|
|
74
|
+
calculateDuration(run) {
|
|
75
|
+
const startTime = run.run_started_at
|
|
76
|
+
? new Date(run.run_started_at).getTime()
|
|
77
|
+
: new Date(run.created_at).getTime();
|
|
78
|
+
const endTime = new Date(run.updated_at).getTime();
|
|
79
|
+
return Math.max(0, endTime - startTime);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get a descriptive failure reason
|
|
83
|
+
*/
|
|
84
|
+
getFailureReason(run, failedJobs) {
|
|
85
|
+
if (run.conclusion === 'cancelled') {
|
|
86
|
+
return 'Workflow was cancelled';
|
|
87
|
+
}
|
|
88
|
+
if (run.conclusion === 'timed_out') {
|
|
89
|
+
return 'Workflow timed out';
|
|
90
|
+
}
|
|
91
|
+
if (failedJobs.length > 0) {
|
|
92
|
+
const jobNames = failedJobs.map((j) => j.name).join(', ');
|
|
93
|
+
return `Jobs failed: ${jobNames}`;
|
|
94
|
+
}
|
|
95
|
+
return `Workflow failed with conclusion: ${run.conclusion}`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Create a workflow event emitter
|
|
100
|
+
*/
|
|
101
|
+
export function createEventEmitter(eventBus) {
|
|
102
|
+
return new WorkflowEventEmitter(eventBus);
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/events/emitter.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,QAAQ,CAAW;IAEpC,YAAY,QAAkB;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,qBAAqB,CAAC,GAAgB;QACpC,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CAAC;YAC1B,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1D,OAAO,gBAAgB,QAAQ,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,oCAAoC,GAAG,CAAC,UAAU,EAAE,CAAC;IAC9D,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAkB;IACnD,OAAO,IAAI,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { PluginEvent } from '../types/events.js';
|
|
2
|
+
/**
|
|
3
|
+
* EventBus facet interface
|
|
4
|
+
*
|
|
5
|
+
* This is the contract that event consumers must implement.
|
|
6
|
+
* It's injected into the plugin at runtime.
|
|
7
|
+
*/
|
|
8
|
+
export interface EventBus {
|
|
9
|
+
/**
|
|
10
|
+
* Emit an event
|
|
11
|
+
* @param event - The event type name
|
|
12
|
+
* @param payload - The event payload
|
|
13
|
+
*/
|
|
14
|
+
emit(event: string, payload: unknown): void;
|
|
15
|
+
/**
|
|
16
|
+
* Subscribe to events
|
|
17
|
+
* @param event - The event type name to subscribe to
|
|
18
|
+
* @param handler - The handler function
|
|
19
|
+
* @returns Unsubscribe function
|
|
20
|
+
*/
|
|
21
|
+
on(event: string, handler: (payload: unknown) => void): () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Subscribe to events once
|
|
24
|
+
* @param event - The event type name to subscribe to
|
|
25
|
+
* @param handler - The handler function
|
|
26
|
+
*/
|
|
27
|
+
once(event: string, handler: (payload: unknown) => void): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Event handler function type
|
|
31
|
+
*/
|
|
32
|
+
export type EventHandler<T extends PluginEvent = PluginEvent> = (event: T) => void | Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Event subscription options
|
|
35
|
+
*/
|
|
36
|
+
export interface SubscriptionOptions {
|
|
37
|
+
/** Only handle events once then unsubscribe */
|
|
38
|
+
once?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Unsubscribe function returned from event subscriptions
|
|
42
|
+
*/
|
|
43
|
+
export type Unsubscribe = () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Simple in-memory event bus implementation for testing
|
|
46
|
+
*/
|
|
47
|
+
export declare class SimpleEventBus implements EventBus {
|
|
48
|
+
private handlers;
|
|
49
|
+
emit(event: string, payload: unknown): void;
|
|
50
|
+
on(event: string, handler: (payload: unknown) => void): () => void;
|
|
51
|
+
once(event: string, handler: (payload: unknown) => void): void;
|
|
52
|
+
/**
|
|
53
|
+
* Remove all handlers (for testing)
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Get the number of handlers for an event (for testing)
|
|
58
|
+
*/
|
|
59
|
+
listenerCount(event: string): number;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/events/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAE5C;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAEnE;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,CAC9D,KAAK,EAAE,CAAC,KACL,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC;;GAEG;AACH,qBAAa,cAAe,YAAW,QAAQ;IAC7C,OAAO,CAAC,QAAQ,CAAsD;IAEtE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAa3C,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI;IAWlE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAQ9D;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAGrC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple in-memory event bus implementation for testing
|
|
3
|
+
*/
|
|
4
|
+
export class SimpleEventBus {
|
|
5
|
+
handlers = new Map();
|
|
6
|
+
emit(event, payload) {
|
|
7
|
+
const eventHandlers = this.handlers.get(event);
|
|
8
|
+
if (eventHandlers) {
|
|
9
|
+
for (const handler of eventHandlers) {
|
|
10
|
+
try {
|
|
11
|
+
handler(payload);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
console.error(`Error in event handler for ${event}:`, error);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
on(event, handler) {
|
|
20
|
+
if (!this.handlers.has(event)) {
|
|
21
|
+
this.handlers.set(event, new Set());
|
|
22
|
+
}
|
|
23
|
+
this.handlers.get(event).add(handler);
|
|
24
|
+
return () => {
|
|
25
|
+
this.handlers.get(event)?.delete(handler);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
once(event, handler) {
|
|
29
|
+
const wrappedHandler = (payload) => {
|
|
30
|
+
this.handlers.get(event)?.delete(wrappedHandler);
|
|
31
|
+
handler(payload);
|
|
32
|
+
};
|
|
33
|
+
this.on(event, wrappedHandler);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Remove all handlers (for testing)
|
|
37
|
+
*/
|
|
38
|
+
clear() {
|
|
39
|
+
this.handlers.clear();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the number of handlers for an event (for testing)
|
|
43
|
+
*/
|
|
44
|
+
listenerCount(event) {
|
|
45
|
+
return this.handlers.get(event)?.size ?? 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/events/types.ts"],"names":[],"mappings":"AAoDA;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,QAAQ,GAAG,IAAI,GAAG,EAA2C,CAAC;IAEtE,IAAI,CAAC,KAAa,EAAE,OAAgB;QAClC,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,aAAa,EAAE,CAAC;YAClB,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;gBACpC,IAAI,CAAC;oBACH,OAAO,CAAC,OAAO,CAAC,CAAC;gBACnB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,KAAK,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC/D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,EAAE,CAAC,KAAa,EAAE,OAAmC;QACnD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAEvC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,OAAmC;QACrD,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC1C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;YACjD,OAAO,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC,CAAC;QACF,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,KAAa;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { GitHubActionsPlugin, createGitHubActionsPlugin, PLUGIN_MANIFEST, } from './plugin.js';
|
|
2
|
+
export type { IssueTracker } from '@generacy-ai/latency';
|
|
3
|
+
export { type GitHubActionsConfig, type PollingOptions, type WorkflowsConfig, gitHubActionsConfigSchema, pollingOptionsSchema, workflowsConfigSchema, parseConfig, DEFAULT_POLLING_CONFIG, } from './types/config.js';
|
|
4
|
+
export { type User, type WorkflowStatus, type WorkflowConclusion, type WorkflowRun, type TriggerWorkflowParams, isTerminalStatus, isSuccessful, isFailed, } from './types/workflows.js';
|
|
5
|
+
export { type JobStatus, type JobConclusion, type StepStatus, type StepConclusion, type Step, type Job, isJobComplete, isJobSuccessful, getFailedSteps, } from './types/jobs.js';
|
|
6
|
+
export { type Artifact, type ArtifactListResponse, isArtifactAvailable, formatArtifactSize, } from './types/artifacts.js';
|
|
7
|
+
export { type CheckStatus, type CheckConclusion, type AnnotationLevel, type CheckAnnotation, type CheckOutput, type CheckRun, type CreateCheckRunParams, type UpdateCheckRunParams, isCheckComplete, isCheckSuccessful, } from './types/check-runs.js';
|
|
8
|
+
export { type WorkflowCompletedEvent, type WorkflowFailedEvent, type CheckRunCompletedEvent, type PluginEvent, type PluginEventType, isWorkflowCompletedEvent, isWorkflowFailedEvent, isCheckRunCompletedEvent, } from './types/events.js';
|
|
9
|
+
export { type EventBus, type EventHandler, type SubscriptionOptions, type Unsubscribe, SimpleEventBus, } from './events/types.js';
|
|
10
|
+
export { type PollingConfig, type PollingResult, type PollingHandle, createPollingConfig, } from './polling/types.js';
|
|
11
|
+
export { GitHubActionsError, RateLimitError, WorkflowNotFoundError, RunNotFoundError, JobNotFoundError, ArtifactNotFoundError, CheckRunNotFoundError, PollingTimeoutError, ConfigurationError, isRateLimitError, isGitHubActionsError, } from './utils/errors.js';
|
|
12
|
+
export { GitHubClient, createClient } from './client.js';
|
|
13
|
+
export { StatusPoller, createStatusPoller, pollUntilComplete, waitForRun, } from './polling/status-poller.js';
|
|
14
|
+
export { WorkflowEventEmitter, createEventEmitter, } from './events/emitter.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,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