@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
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { isTerminalStatus } from '../types/workflows.js';
|
|
2
|
+
import { getWorkflowRun } from '../operations/runs.js';
|
|
3
|
+
import { PollingTimeoutError, RateLimitError } from '../utils/errors.js';
|
|
4
|
+
import { createPollingConfig } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Status poller for monitoring workflow run status changes
|
|
7
|
+
*/
|
|
8
|
+
export class StatusPoller {
|
|
9
|
+
client;
|
|
10
|
+
config;
|
|
11
|
+
cancelled = false;
|
|
12
|
+
constructor(client, config) {
|
|
13
|
+
this.client = client;
|
|
14
|
+
this.config = createPollingConfig(config);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Poll for workflow run status until it reaches a terminal state
|
|
18
|
+
*
|
|
19
|
+
* @param runId - Workflow run ID to monitor
|
|
20
|
+
* @returns Polling result with final run state
|
|
21
|
+
*/
|
|
22
|
+
async poll(runId) {
|
|
23
|
+
let attempts = 0;
|
|
24
|
+
let lastRun = null;
|
|
25
|
+
let lastStatus = null;
|
|
26
|
+
let currentInterval = this.config.interval;
|
|
27
|
+
while (attempts < this.config.maxAttempts && !this.cancelled) {
|
|
28
|
+
attempts++;
|
|
29
|
+
this.config.onPoll?.(attempts, this.config.maxAttempts);
|
|
30
|
+
try {
|
|
31
|
+
const run = await getWorkflowRun(this.client, runId);
|
|
32
|
+
lastRun = run;
|
|
33
|
+
// Check if status changed
|
|
34
|
+
if (lastStatus !== run.status) {
|
|
35
|
+
lastStatus = run.status;
|
|
36
|
+
this.config.onUpdate?.(run);
|
|
37
|
+
}
|
|
38
|
+
// Check for terminal state
|
|
39
|
+
if (isTerminalStatus(run.status)) {
|
|
40
|
+
this.config.onComplete?.(run);
|
|
41
|
+
return {
|
|
42
|
+
completed: true,
|
|
43
|
+
run,
|
|
44
|
+
attempts,
|
|
45
|
+
timedOut: false,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// Reset interval on successful poll
|
|
49
|
+
currentInterval = this.config.interval;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof RateLimitError) {
|
|
53
|
+
// Use exponential backoff on rate limit
|
|
54
|
+
currentInterval = Math.min(currentInterval * 2, error.getTimeUntilReset() + 1000);
|
|
55
|
+
this.config.onError?.(error);
|
|
56
|
+
}
|
|
57
|
+
else if (error instanceof Error) {
|
|
58
|
+
this.config.onError?.(error);
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Wait before next poll
|
|
66
|
+
if (!this.cancelled && attempts < this.config.maxAttempts) {
|
|
67
|
+
await this.delay(currentInterval);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Polling timed out or was cancelled
|
|
71
|
+
if (this.cancelled && lastRun) {
|
|
72
|
+
return {
|
|
73
|
+
completed: false,
|
|
74
|
+
run: lastRun,
|
|
75
|
+
attempts,
|
|
76
|
+
timedOut: false,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (lastRun) {
|
|
80
|
+
throw new PollingTimeoutError(runId, this.config.maxAttempts);
|
|
81
|
+
}
|
|
82
|
+
throw new Error(`Failed to get workflow run ${runId}`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Start polling and return a handle for control
|
|
86
|
+
*
|
|
87
|
+
* @param runId - Workflow run ID to monitor
|
|
88
|
+
* @returns Polling handle with promise and cancel function
|
|
89
|
+
*/
|
|
90
|
+
start(runId) {
|
|
91
|
+
let active = true;
|
|
92
|
+
const promise = this.poll(runId).finally(() => {
|
|
93
|
+
active = false;
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
promise,
|
|
97
|
+
cancel: () => {
|
|
98
|
+
this.cancelled = true;
|
|
99
|
+
active = false;
|
|
100
|
+
},
|
|
101
|
+
isActive: () => active,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Cancel any active polling
|
|
106
|
+
*/
|
|
107
|
+
cancel() {
|
|
108
|
+
this.cancelled = true;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Delay for the specified duration
|
|
112
|
+
*/
|
|
113
|
+
delay(ms) {
|
|
114
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a new status poller
|
|
119
|
+
*/
|
|
120
|
+
export function createStatusPoller(client, config) {
|
|
121
|
+
return new StatusPoller(client, config);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Poll for a workflow run to complete
|
|
125
|
+
*
|
|
126
|
+
* @param client - GitHub API client
|
|
127
|
+
* @param runId - Workflow run ID
|
|
128
|
+
* @param config - Optional polling configuration
|
|
129
|
+
* @returns The completed workflow run
|
|
130
|
+
*/
|
|
131
|
+
export async function pollUntilComplete(client, runId, config) {
|
|
132
|
+
const poller = createStatusPoller(client, config);
|
|
133
|
+
const result = await poller.poll(runId);
|
|
134
|
+
return result.run;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Wait for a workflow run with timeout
|
|
138
|
+
*
|
|
139
|
+
* @param client - GitHub API client
|
|
140
|
+
* @param runId - Workflow run ID
|
|
141
|
+
* @param timeoutMs - Maximum time to wait in milliseconds
|
|
142
|
+
* @param intervalMs - Polling interval in milliseconds
|
|
143
|
+
* @returns The workflow run (may not be complete if timeout reached)
|
|
144
|
+
*/
|
|
145
|
+
export async function waitForRun(client, runId, timeoutMs = 600000, intervalMs = 10000) {
|
|
146
|
+
const maxAttempts = Math.ceil(timeoutMs / intervalMs);
|
|
147
|
+
const poller = createStatusPoller(client, {
|
|
148
|
+
interval: intervalMs,
|
|
149
|
+
maxAttempts,
|
|
150
|
+
});
|
|
151
|
+
try {
|
|
152
|
+
return await poller.poll(runId);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (error instanceof PollingTimeoutError) {
|
|
156
|
+
const run = await getWorkflowRun(client, runId);
|
|
157
|
+
return {
|
|
158
|
+
completed: false,
|
|
159
|
+
run,
|
|
160
|
+
attempts: maxAttempts,
|
|
161
|
+
timedOut: true,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=status-poller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-poller.js","sourceRoot":"","sources":["../../src/polling/status-poller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,YAAY;IACN,MAAM,CAAe;IACrB,MAAM,CAAgB;IAC/B,SAAS,GAAG,KAAK,CAAC;IAE1B,YAAY,MAAoB,EAAE,MAA+B;QAC/D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,KAAa;QACtB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,OAAO,GAAuB,IAAI,CAAC;QACvC,IAAI,UAAU,GAAkB,IAAI,CAAC;QACrC,IAAI,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAE3C,OAAO,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAC7D,QAAQ,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAExD,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBACrD,O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G;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAoB,EACpB,KAAa,EACb,MAA+B;IAE/B,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,GAAG,CAAC;AACpB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAoB,EACpB,KAAa,EACb,YAAoB,MAAM,EAC1B,aAAqB,KAAK;IAE1B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,EAAE;QACxC,QAAQ,EAAE,UAAU;QACpB,WAAW;KACZ,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;YACzC,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAChD,OAAO;gBACL,SAAS,EAAE,KAAK;gBAChB,GAAG;gBACH,QAAQ,EAAE,WAAW;gBACrB,QAAQ,EAAE,IAAI;aACf,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { WorkflowRun } from '../types/workflows.js';
|
|
2
|
+
/**
|
|
3
|
+
* Polling configuration for workflow run monitoring
|
|
4
|
+
*/
|
|
5
|
+
export interface PollingConfig {
|
|
6
|
+
/** Polling interval in milliseconds (default: 10000) */
|
|
7
|
+
interval: number;
|
|
8
|
+
/** Maximum number of polling attempts (default: 60) */
|
|
9
|
+
maxAttempts: number;
|
|
10
|
+
/** Callback when run status changes */
|
|
11
|
+
onUpdate?: (run: WorkflowRun) => void;
|
|
12
|
+
/** Callback when run completes (terminal state) */
|
|
13
|
+
onComplete?: (run: WorkflowRun) => void;
|
|
14
|
+
/** Callback when an error occurs during polling */
|
|
15
|
+
onError?: (error: Error) => void;
|
|
16
|
+
/** Callback on each poll (for progress tracking) */
|
|
17
|
+
onPoll?: (attempt: number, maxAttempts: number) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Result from a polling operation
|
|
21
|
+
*/
|
|
22
|
+
export interface PollingResult {
|
|
23
|
+
/** Whether the run reached a terminal state */
|
|
24
|
+
completed: boolean;
|
|
25
|
+
/** The final workflow run state */
|
|
26
|
+
run: WorkflowRun;
|
|
27
|
+
/** Number of poll attempts made */
|
|
28
|
+
attempts: number;
|
|
29
|
+
/** Whether polling timed out */
|
|
30
|
+
timedOut: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Polling handle for controlling an active polling operation
|
|
34
|
+
*/
|
|
35
|
+
export interface PollingHandle {
|
|
36
|
+
/** Promise that resolves when polling completes or times out */
|
|
37
|
+
promise: Promise<PollingResult>;
|
|
38
|
+
/** Cancel the polling operation */
|
|
39
|
+
cancel: () => void;
|
|
40
|
+
/** Check if polling is still active */
|
|
41
|
+
isActive: () => boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Default polling configuration values
|
|
45
|
+
*/
|
|
46
|
+
export declare const DEFAULT_POLLING_CONFIG: {
|
|
47
|
+
readonly interval: 10000;
|
|
48
|
+
readonly maxAttempts: 60;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Create a polling config with defaults applied
|
|
52
|
+
*/
|
|
53
|
+
export declare function createPollingConfig(options?: Partial<PollingConfig>): PollingConfig;
|
|
54
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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
|
+
* Default polling configuration values
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_POLLING_CONFIG = {
|
|
5
|
+
interval: 10000,
|
|
6
|
+
maxAttempts: 60,
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Create a polling config with defaults applied
|
|
10
|
+
*/
|
|
11
|
+
export function createPollingConfig(options) {
|
|
12
|
+
return {
|
|
13
|
+
interval: options?.interval ?? DEFAULT_POLLING_CONFIG.interval,
|
|
14
|
+
maxAttempts: options?.maxAttempts ?? DEFAULT_POLLING_CONFIG.maxAttempts,
|
|
15
|
+
onUpdate: options?.onUpdate,
|
|
16
|
+
onComplete: options?.onComplete,
|
|
17
|
+
onError: options?.onError,
|
|
18
|
+
onPoll: options?.onPoll,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/polling/types.ts"],"names":[],"mappings":"AA8CA;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,EAAE;CACP,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAgC;IAEhC,OAAO;QACL,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,sBAAsB,CAAC,QAAQ;QAC9D,WAAW,EAAE,OAAO,EAAE,WAAW,IAAI,sBAAsB,CAAC,WAAW;QACvE,QAAQ,EAAE,OAAO,EAAE,QAAQ;QAC3B,UAAU,EAAE,OAAO,EAAE,UAAU;QAC/B,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,MAAM,EAAE,OAAO,EAAE,MAAM;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a workflow artifact
|
|
3
|
+
*/
|
|
4
|
+
export interface Artifact {
|
|
5
|
+
/** Unique artifact ID */
|
|
6
|
+
id: number;
|
|
7
|
+
/** Node ID (GraphQL) */
|
|
8
|
+
node_id: string;
|
|
9
|
+
/** Artifact name */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Size in bytes */
|
|
12
|
+
size_in_bytes: number;
|
|
13
|
+
/** Download URL */
|
|
14
|
+
archive_download_url: string;
|
|
15
|
+
/** Whether artifact has expired */
|
|
16
|
+
expired: boolean;
|
|
17
|
+
/** Created timestamp */
|
|
18
|
+
created_at: string;
|
|
19
|
+
/** Updated timestamp */
|
|
20
|
+
updated_at: string;
|
|
21
|
+
/** Expiration timestamp */
|
|
22
|
+
expires_at: string;
|
|
23
|
+
/** Workflow run ID that created this artifact */
|
|
24
|
+
workflow_run?: {
|
|
25
|
+
id: number;
|
|
26
|
+
repository_id: number;
|
|
27
|
+
head_repository_id: number;
|
|
28
|
+
head_branch: string;
|
|
29
|
+
head_sha: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Response from listing artifacts
|
|
34
|
+
*/
|
|
35
|
+
export interface ArtifactListResponse {
|
|
36
|
+
/** Total count of artifacts */
|
|
37
|
+
total_count: number;
|
|
38
|
+
/** Array of artifacts */
|
|
39
|
+
artifacts: Artifact[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if an artifact is still available for download
|
|
43
|
+
*/
|
|
44
|
+
export declare function isArtifactAvailable(artifact: Artifact): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Format artifact size for display
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatArtifactSize(sizeInBytes: number): string;
|
|
49
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/types/artifacts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,yBAAyB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,YAAY,CAAC,EAAE;QACb,EAAE,EAAE,MAAM,CAAC;QACX,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAW9D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if an artifact is still available for download
|
|
3
|
+
*/
|
|
4
|
+
export function isArtifactAvailable(artifact) {
|
|
5
|
+
return !artifact.expired;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Format artifact size for display
|
|
9
|
+
*/
|
|
10
|
+
export function formatArtifactSize(sizeInBytes) {
|
|
11
|
+
if (sizeInBytes < 1024) {
|
|
12
|
+
return `${sizeInBytes} B`;
|
|
13
|
+
}
|
|
14
|
+
if (sizeInBytes < 1024 * 1024) {
|
|
15
|
+
return `${(sizeInBytes / 1024).toFixed(2)} KB`;
|
|
16
|
+
}
|
|
17
|
+
if (sizeInBytes < 1024 * 1024 * 1024) {
|
|
18
|
+
return `${(sizeInBytes / (1024 * 1024)).toFixed(2)} MB`;
|
|
19
|
+
}
|
|
20
|
+
return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/types/artifacts.ts"],"names":[],"mappings":"AA0CA;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAkB;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACpD,IAAI,WAAW,GAAG,IAAI,EAAE,CAAC;QACvB,OAAO,GAAG,WAAW,IAAI,CAAC;IAC5B,CAAC;IACD,IAAI,WAAW,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IACjD,CAAC;IACD,IAAI,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QACrC,OAAO,GAAG,CAAC,WAAW,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1D,CAAC;IACD,OAAO,GAAG,CAAC,WAAW,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check run status
|
|
3
|
+
*/
|
|
4
|
+
export type CheckStatus = 'queued' | 'in_progress' | 'completed';
|
|
5
|
+
/**
|
|
6
|
+
* Check run conclusion
|
|
7
|
+
*/
|
|
8
|
+
export type CheckConclusion = 'success' | 'failure' | 'neutral' | 'cancelled' | 'skipped' | 'timed_out' | 'action_required' | null;
|
|
9
|
+
/**
|
|
10
|
+
* Annotation level for check run annotations
|
|
11
|
+
*/
|
|
12
|
+
export type AnnotationLevel = 'notice' | 'warning' | 'failure';
|
|
13
|
+
/**
|
|
14
|
+
* Check run annotation
|
|
15
|
+
*/
|
|
16
|
+
export interface CheckAnnotation {
|
|
17
|
+
/** File path relative to repository root */
|
|
18
|
+
path: string;
|
|
19
|
+
/** Start line number */
|
|
20
|
+
start_line: number;
|
|
21
|
+
/** End line number */
|
|
22
|
+
end_line: number;
|
|
23
|
+
/** Start column (optional) */
|
|
24
|
+
start_column?: number;
|
|
25
|
+
/** End column (optional) */
|
|
26
|
+
end_column?: number;
|
|
27
|
+
/** Annotation level */
|
|
28
|
+
annotation_level: AnnotationLevel;
|
|
29
|
+
/** Annotation message */
|
|
30
|
+
message: string;
|
|
31
|
+
/** Annotation title (optional) */
|
|
32
|
+
title?: string;
|
|
33
|
+
/** Raw details (optional) */
|
|
34
|
+
raw_details?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check run output displayed in GitHub UI
|
|
38
|
+
*/
|
|
39
|
+
export interface CheckOutput {
|
|
40
|
+
/** Output title */
|
|
41
|
+
title: string;
|
|
42
|
+
/** Output summary (supports markdown) */
|
|
43
|
+
summary: string;
|
|
44
|
+
/** Detailed text (optional, supports markdown) */
|
|
45
|
+
text?: string;
|
|
46
|
+
/** Annotations (optional, max 50) */
|
|
47
|
+
annotations?: CheckAnnotation[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Represents a GitHub Check Run
|
|
51
|
+
*/
|
|
52
|
+
export interface CheckRun {
|
|
53
|
+
/** Unique check run ID */
|
|
54
|
+
id: number;
|
|
55
|
+
/** Node ID (GraphQL) */
|
|
56
|
+
node_id: string;
|
|
57
|
+
/** Check name */
|
|
58
|
+
name: string;
|
|
59
|
+
/** HEAD SHA */
|
|
60
|
+
head_sha: string;
|
|
61
|
+
/** External ID for correlation */
|
|
62
|
+
external_id?: string;
|
|
63
|
+
/** Status */
|
|
64
|
+
status: CheckStatus;
|
|
65
|
+
/** Conclusion (when completed) */
|
|
66
|
+
conclusion: CheckConclusion;
|
|
67
|
+
/** Details URL */
|
|
68
|
+
details_url?: string;
|
|
69
|
+
/** HTML URL */
|
|
70
|
+
html_url: string;
|
|
71
|
+
/** Output displayed in GitHub UI */
|
|
72
|
+
output?: {
|
|
73
|
+
title: string | null;
|
|
74
|
+
summary: string | null;
|
|
75
|
+
text: string | null;
|
|
76
|
+
annotations_count: number;
|
|
77
|
+
};
|
|
78
|
+
/** Started timestamp */
|
|
79
|
+
started_at?: string;
|
|
80
|
+
/** Completed timestamp */
|
|
81
|
+
completed_at?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Parameters for creating a check run
|
|
85
|
+
*/
|
|
86
|
+
export interface CreateCheckRunParams {
|
|
87
|
+
/** Check name */
|
|
88
|
+
name: string;
|
|
89
|
+
/** HEAD SHA to attach check to */
|
|
90
|
+
head_sha: string;
|
|
91
|
+
/** External ID for correlation */
|
|
92
|
+
external_id?: string;
|
|
93
|
+
/** Details URL */
|
|
94
|
+
details_url?: string;
|
|
95
|
+
/** Initial status */
|
|
96
|
+
status?: CheckStatus;
|
|
97
|
+
/** Initial output */
|
|
98
|
+
output?: CheckOutput;
|
|
99
|
+
/** Started timestamp (ISO 8601) */
|
|
100
|
+
started_at?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Parameters for updating a check run
|
|
104
|
+
*/
|
|
105
|
+
export interface UpdateCheckRunParams {
|
|
106
|
+
/** Updated status */
|
|
107
|
+
status?: CheckStatus;
|
|
108
|
+
/** Conclusion (required when status is 'completed') */
|
|
109
|
+
conclusion?: CheckConclusion;
|
|
110
|
+
/** Updated output */
|
|
111
|
+
output?: CheckOutput;
|
|
112
|
+
/** Completion timestamp (ISO 8601) */
|
|
113
|
+
completed_at?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Check if a check run is complete
|
|
117
|
+
*/
|
|
118
|
+
export declare function isCheckComplete(check: CheckRun): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Check if a check run was successful
|
|
121
|
+
*/
|
|
122
|
+
export declare function isCheckSuccessful(check: CheckRun): boolean;
|
|
123
|
+
//# sourceMappingURL=check-runs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-runs.d.ts","sourceRoot":"","sources":["../../src/types/check-runs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,WAAW,GACX,iBAAiB,GACjB,IAAI,CAAC;AAET;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,gBAAgB,EAAE,eAAe,CAAC;IAClC,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA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IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,qBAAqB;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,uDAAuD;IACvD,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,qBAAqB;IACrB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAE1D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a check run is complete
|
|
3
|
+
*/
|
|
4
|
+
export function isCheckComplete(check) {
|
|
5
|
+
return check.status === 'completed';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Check if a check run was successful
|
|
9
|
+
*/
|
|
10
|
+
export function isCheckSuccessful(check) {
|
|
11
|
+
return check.status === 'completed' && check.conclusion === 'success';
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=check-runs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-runs.js","sourceRoot":"","sources":["../../src/types/check-runs.ts"],"names":[],"mappings":"AAkIA;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAe;IAC7C,OAAO,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAe;IAC/C,OAAO,KAAK,CAAC,MAAM,KAAK,WAAW,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Polling configuration for status monitoring
|
|
4
|
+
*/
|
|
5
|
+
export interface PollingOptions {
|
|
6
|
+
/** Polling interval in milliseconds (default: 10000) */
|
|
7
|
+
interval?: number;
|
|
8
|
+
/** Maximum polling attempts (default: 60) */
|
|
9
|
+
maxAttempts?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Named workflows for common operations
|
|
13
|
+
*/
|
|
14
|
+
export interface WorkflowsConfig {
|
|
15
|
+
/** CI workflow filename (e.g., "ci.yml") */
|
|
16
|
+
ci?: string;
|
|
17
|
+
/** Deploy workflow filename (e.g., "deploy.yml") */
|
|
18
|
+
deploy?: string;
|
|
19
|
+
/** Test workflow filename (e.g., "test.yml") */
|
|
20
|
+
test?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Plugin configuration interface
|
|
24
|
+
*/
|
|
25
|
+
export interface GitHubActionsConfig {
|
|
26
|
+
/** Repository owner (user or organization) */
|
|
27
|
+
owner: string;
|
|
28
|
+
/** Repository name */
|
|
29
|
+
repo: string;
|
|
30
|
+
/** GitHub Personal Access Token */
|
|
31
|
+
token: string;
|
|
32
|
+
/** Named workflows for common operations */
|
|
33
|
+
workflows?: WorkflowsConfig;
|
|
34
|
+
/** Polling configuration */
|
|
35
|
+
polling?: PollingOptions;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Zod schema for polling configuration validation
|
|
39
|
+
*/
|
|
40
|
+
export declare const pollingOptionsSchema: z.ZodObject<{
|
|
41
|
+
interval: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
interval?: number | undefined;
|
|
45
|
+
maxAttempts?: number | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
interval?: number | undefined;
|
|
48
|
+
maxAttempts?: number | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Zod schema for workflows configuration validation
|
|
52
|
+
*/
|
|
53
|
+
export declare const workflowsConfigSchema: z.ZodObject<{
|
|
54
|
+
ci: z.ZodOptional<z.ZodString>;
|
|
55
|
+
deploy: z.ZodOptional<z.ZodString>;
|
|
56
|
+
test: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
ci?: string | undefined;
|
|
59
|
+
deploy?: string | undefined;
|
|
60
|
+
test?: string | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
ci?: string | undefined;
|
|
63
|
+
deploy?: string | undefined;
|
|
64
|
+
test?: string | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Zod schema for plugin configuration validation
|
|
68
|
+
*/
|
|
69
|
+
export declare const gitHubActionsConfigSchema: z.ZodObject<{
|
|
70
|
+
owner: z.ZodString;
|
|
71
|
+
repo: z.ZodString;
|
|
72
|
+
token: z.ZodString;
|
|
73
|
+
workflows: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
ci: z.ZodOptional<z.ZodString>;
|
|
75
|
+
deploy: z.ZodOptional<z.ZodString>;
|
|
76
|
+
test: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
ci?: string | undefined;
|
|
79
|
+
deploy?: string | undefined;
|
|
80
|
+
test?: string | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
ci?: string | undefined;
|
|
83
|
+
deploy?: string | undefined;
|
|
84
|
+
test?: string | undefined;
|
|
85
|
+
}>>;
|
|
86
|
+
polling: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
interval: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
interval?: number | undefined;
|
|
91
|
+
maxAttempts?: number | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
interval?: number | undefined;
|
|
94
|
+
maxAttempts?: number | undefined;
|
|
95
|
+
}>>;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
owner: string;
|
|
98
|
+
repo: string;
|
|
99
|
+
token: string;
|
|
100
|
+
workflows?: {
|
|
101
|
+
ci?: string | undefined;
|
|
102
|
+
deploy?: string | undefined;
|
|
103
|
+
test?: string | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
polling?: {
|
|
106
|
+
interval?: number | undefined;
|
|
107
|
+
maxAttempts?: number | undefined;
|
|
108
|
+
} | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
owner: string;
|
|
111
|
+
repo: string;
|
|
112
|
+
token: string;
|
|
113
|
+
workflows?: {
|
|
114
|
+
ci?: string | undefined;
|
|
115
|
+
deploy?: string | undefined;
|
|
116
|
+
test?: string | undefined;
|
|
117
|
+
} | undefined;
|
|
118
|
+
polling?: {
|
|
119
|
+
interval?: number | undefined;
|
|
120
|
+
maxAttempts?: number | undefined;
|
|
121
|
+
} | undefined;
|
|
122
|
+
}>;
|
|
123
|
+
/**
|
|
124
|
+
* Default polling configuration values
|
|
125
|
+
*/
|
|
126
|
+
export declare const DEFAULT_POLLING_CONFIG: Required<PollingOptions>;
|
|
127
|
+
/**
|
|
128
|
+
* Validate and parse plugin configuration
|
|
129
|
+
*/
|
|
130
|
+
export declare function parseConfig(config: unknown): GitHubActionsConfig;
|
|
131
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,4BAA4B;IAC5B,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAIhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,cAAc,CAG3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,CAEhE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for polling configuration validation
|
|
4
|
+
*/
|
|
5
|
+
export const pollingOptionsSchema = z.object({
|
|
6
|
+
interval: z.number().min(1000, 'Polling interval must be at least 1000ms').optional(),
|
|
7
|
+
maxAttempts: z.number().min(1, 'Max attempts must be at least 1').optional(),
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Zod schema for workflows configuration validation
|
|
11
|
+
*/
|
|
12
|
+
export const workflowsConfigSchema = z.object({
|
|
13
|
+
ci: z.string().optional(),
|
|
14
|
+
deploy: z.string().optional(),
|
|
15
|
+
test: z.string().optional(),
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Zod schema for plugin configuration validation
|
|
19
|
+
*/
|
|
20
|
+
export const gitHubActionsConfigSchema = z.object({
|
|
21
|
+
owner: z.string().min(1, 'Owner is required'),
|
|
22
|
+
repo: z.string().min(1, 'Repo is required'),
|
|
23
|
+
token: z.string().min(1, 'Token is required'),
|
|
24
|
+
workflows: workflowsConfigSchema.optional(),
|
|
25
|
+
polling: pollingOptionsSchema.optional(),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Default polling configuration values
|
|
29
|
+
*/
|
|
30
|
+
export const DEFAULT_POLLING_CONFIG = {
|
|
31
|
+
interval: 10000,
|
|
32
|
+
maxAttempts: 60,
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Validate and parse plugin configuration
|
|
36
|
+
*/
|
|
37
|
+
export function parseConfig(config) {
|
|
38
|
+
return gitHubActionsConfigSchema.parse(config);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwCxB;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,0CAA0C,CAAC,CAAC,QAAQ,EAAE;IACrF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,iCAAiC,CAAC,CAAC,QAAQ,EAAE;CAC7E,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM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