@memberjunction/core-actions 6.2.0 → 6.3.0-edge.0

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.
Files changed (131) hide show
  1. package/README.md +28 -2
  2. package/dist/custom/ai/base-find-skills.action.d.ts +56 -0
  3. package/dist/custom/ai/base-find-skills.action.d.ts.map +1 -0
  4. package/dist/custom/ai/base-find-skills.action.js +237 -0
  5. package/dist/custom/ai/base-find-skills.action.js.map +1 -0
  6. package/dist/custom/ai/configure-agent-user-policy.action.d.ts.map +1 -1
  7. package/dist/custom/ai/configure-agent-user-policy.action.js +96 -15
  8. package/dist/custom/ai/configure-agent-user-policy.action.js.map +1 -1
  9. package/dist/custom/ai/find-best-skill.action.d.ts +13 -0
  10. package/dist/custom/ai/find-best-skill.action.d.ts.map +1 -0
  11. package/dist/custom/ai/find-best-skill.action.js +29 -0
  12. package/dist/custom/ai/find-best-skill.action.js.map +1 -0
  13. package/dist/custom/ai/find-candidate-skills.action.d.ts +21 -0
  14. package/dist/custom/ai/find-candidate-skills.action.d.ts.map +1 -0
  15. package/dist/custom/ai/find-candidate-skills.action.js +35 -0
  16. package/dist/custom/ai/find-candidate-skills.action.js.map +1 -0
  17. package/dist/custom/ai/get-skill-details.action.d.ts +40 -0
  18. package/dist/custom/ai/get-skill-details.action.d.ts.map +1 -0
  19. package/dist/custom/ai/get-skill-details.action.js +133 -0
  20. package/dist/custom/ai/get-skill-details.action.js.map +1 -0
  21. package/dist/custom/ai/prepare-outbound-call-brief.action.d.ts.map +1 -1
  22. package/dist/custom/ai/prepare-outbound-call-brief.action.js +10 -1
  23. package/dist/custom/ai/prepare-outbound-call-brief.action.js.map +1 -1
  24. package/dist/custom/ai/schedule-next-agent-wake.action.d.ts +16 -0
  25. package/dist/custom/ai/schedule-next-agent-wake.action.d.ts.map +1 -1
  26. package/dist/custom/ai/schedule-next-agent-wake.action.js +100 -17
  27. package/dist/custom/ai/schedule-next-agent-wake.action.js.map +1 -1
  28. package/dist/custom/ai/semantic-entity-search.helper.d.ts +1 -1
  29. package/dist/custom/ai/semantic-entity-search.helper.d.ts.map +1 -1
  30. package/dist/custom/ai/send-inter-agent-request.action.d.ts +17 -6
  31. package/dist/custom/ai/send-inter-agent-request.action.d.ts.map +1 -1
  32. package/dist/custom/ai/send-inter-agent-request.action.js +227 -29
  33. package/dist/custom/ai/send-inter-agent-request.action.js.map +1 -1
  34. package/dist/custom/ai/trigger-agent-wake.action.d.ts +19 -0
  35. package/dist/custom/ai/trigger-agent-wake.action.d.ts.map +1 -0
  36. package/dist/custom/ai/trigger-agent-wake.action.js +134 -0
  37. package/dist/custom/ai/trigger-agent-wake.action.js.map +1 -0
  38. package/dist/custom/ai/user-scoped-communication.action.d.ts +1 -1
  39. package/dist/custom/ai/user-scoped-communication.action.d.ts.map +1 -1
  40. package/dist/custom/ai/user-scoped-communication.action.js +13 -7
  41. package/dist/custom/ai/user-scoped-communication.action.js.map +1 -1
  42. package/dist/custom/communication/teams-webhook.action.d.ts +5 -0
  43. package/dist/custom/communication/teams-webhook.action.d.ts.map +1 -1
  44. package/dist/custom/communication/teams-webhook.action.js +15 -1
  45. package/dist/custom/communication/teams-webhook.action.js.map +1 -1
  46. package/dist/custom/crud/agent-data-policy-guard.d.ts +155 -0
  47. package/dist/custom/crud/agent-data-policy-guard.d.ts.map +1 -0
  48. package/dist/custom/crud/agent-data-policy-guard.js +898 -0
  49. package/dist/custom/crud/agent-data-policy-guard.js.map +1 -0
  50. package/dist/custom/crud/create-record.action.d.ts.map +1 -1
  51. package/dist/custom/crud/create-record.action.js +25 -0
  52. package/dist/custom/crud/create-record.action.js.map +1 -1
  53. package/dist/custom/crud/delete-record.action.d.ts.map +1 -1
  54. package/dist/custom/crud/delete-record.action.js +36 -1
  55. package/dist/custom/crud/delete-record.action.js.map +1 -1
  56. package/dist/custom/crud/get-record.action.d.ts.map +1 -1
  57. package/dist/custom/crud/get-record.action.js +36 -1
  58. package/dist/custom/crud/get-record.action.js.map +1 -1
  59. package/dist/custom/crud/get-records.action.d.ts +3 -3
  60. package/dist/custom/crud/get-records.action.d.ts.map +1 -1
  61. package/dist/custom/crud/get-records.action.js +55 -6
  62. package/dist/custom/crud/get-records.action.js.map +1 -1
  63. package/dist/custom/crud/update-record.action.d.ts.map +1 -1
  64. package/dist/custom/crud/update-record.action.js +82 -0
  65. package/dist/custom/crud/update-record.action.js.map +1 -1
  66. package/dist/custom/crud/write-entity-fields.action.d.ts.map +1 -1
  67. package/dist/custom/crud/write-entity-fields.action.js +73 -0
  68. package/dist/custom/crud/write-entity-fields.action.js.map +1 -1
  69. package/dist/custom/data/get-entity-details.action.d.ts.map +1 -1
  70. package/dist/custom/data/get-entity-details.action.js +33 -2
  71. package/dist/custom/data/get-entity-details.action.js.map +1 -1
  72. package/dist/custom/data/get-graph-context.action.d.ts +39 -0
  73. package/dist/custom/data/get-graph-context.action.d.ts.map +1 -0
  74. package/dist/custom/data/get-graph-context.action.js +303 -0
  75. package/dist/custom/data/get-graph-context.action.js.map +1 -0
  76. package/dist/custom/data/run-adhoc-query.action.d.ts.map +1 -1
  77. package/dist/custom/data/run-adhoc-query.action.js +6 -1
  78. package/dist/custom/data/run-adhoc-query.action.js.map +1 -1
  79. package/dist/custom/data/run-stored-query.action.d.ts.map +1 -1
  80. package/dist/custom/data/run-stored-query.action.js +8 -2
  81. package/dist/custom/data/run-stored-query.action.js.map +1 -1
  82. package/dist/custom/github/base-github.action.d.ts +51 -0
  83. package/dist/custom/github/base-github.action.d.ts.map +1 -0
  84. package/dist/custom/github/base-github.action.js +220 -0
  85. package/dist/custom/github/base-github.action.js.map +1 -0
  86. package/dist/custom/github/github-actions.d.ts +66 -0
  87. package/dist/custom/github/github-actions.d.ts.map +1 -0
  88. package/dist/custom/github/github-actions.js +715 -0
  89. package/dist/custom/github/github-actions.js.map +1 -0
  90. package/dist/custom/github/github-app-auth.d.ts +122 -0
  91. package/dist/custom/github/github-app-auth.d.ts.map +1 -0
  92. package/dist/custom/github/github-app-auth.js +396 -0
  93. package/dist/custom/github/github-app-auth.js.map +1 -0
  94. package/dist/custom/github/github-client.d.ts +288 -0
  95. package/dist/custom/github/github-client.d.ts.map +1 -0
  96. package/dist/custom/github/github-client.js +891 -0
  97. package/dist/custom/github/github-client.js.map +1 -0
  98. package/dist/custom/github/github-credential-resolver.d.ts +73 -0
  99. package/dist/custom/github/github-credential-resolver.d.ts.map +1 -0
  100. package/dist/custom/github/github-credential-resolver.js +330 -0
  101. package/dist/custom/github/github-credential-resolver.js.map +1 -0
  102. package/dist/custom/github/github-types.d.ts +216 -0
  103. package/dist/custom/github/github-types.d.ts.map +1 -0
  104. package/dist/custom/github/github-types.js +11 -0
  105. package/dist/custom/github/github-types.js.map +1 -0
  106. package/dist/custom/github/index.d.ts +7 -0
  107. package/dist/custom/github/index.d.ts.map +1 -0
  108. package/dist/custom/github/index.js +7 -0
  109. package/dist/custom/github/index.js.map +1 -0
  110. package/dist/custom/utilities/docx-renderer.d.ts.map +1 -1
  111. package/dist/custom/utilities/docx-renderer.js +29 -6
  112. package/dist/custom/utilities/docx-renderer.js.map +1 -1
  113. package/dist/custom/visualization/create-svg-network.action.js +1 -1
  114. package/dist/custom/visualization/create-svg-network.action.js.map +1 -1
  115. package/dist/custom/visualization/create-svg-sketch-diagram.action.js +3 -3
  116. package/dist/custom/visualization/create-svg-sketch-diagram.action.js.map +1 -1
  117. package/dist/custom/visualization/shared/svg-utils.d.ts +23 -5
  118. package/dist/custom/visualization/shared/svg-utils.d.ts.map +1 -1
  119. package/dist/custom/visualization/shared/svg-utils.js +54 -19
  120. package/dist/custom/visualization/shared/svg-utils.js.map +1 -1
  121. package/dist/custom/web/rss-feed-parsing.d.ts.map +1 -1
  122. package/dist/custom/web/rss-feed-parsing.js +15 -1
  123. package/dist/custom/web/rss-feed-parsing.js.map +1 -1
  124. package/dist/custom/web/url-metadata-extractor.action.d.ts.map +1 -1
  125. package/dist/custom/web/url-metadata-extractor.action.js +21 -8
  126. package/dist/custom/web/url-metadata-extractor.action.js.map +1 -1
  127. package/dist/index.d.ts +7 -0
  128. package/dist/index.d.ts.map +1 -1
  129. package/dist/index.js +8 -0
  130. package/dist/index.js.map +1 -1
  131. package/package.json +46 -45
@@ -0,0 +1,715 @@
1
+ /**
2
+ * @fileoverview Curated, compound MemberJunction Actions for GitHub engineering workflows.
3
+ *
4
+ * Implements the 14 high-signal GitHub Actions designed for LLM agent loops:
5
+ * 1. `GitHub - Get Repository Context`
6
+ * 2. `GitHub - Read Repository File`
7
+ * 3. `GitHub - List Repository Tree`
8
+ * 4. `GitHub - Search Code`
9
+ * 5. `GitHub - Commit Files and Create PR`
10
+ * 6. `GitHub - Commit Files to Branch`
11
+ * 7. `GitHub - Get Pull Request Context`
12
+ * 8. `GitHub - Create Pull Request`
13
+ * 9. `GitHub - Submit Pull Request Review`
14
+ * 10. `GitHub - Merge Pull Request`
15
+ * 11. `GitHub - Search Issues and PRs`
16
+ * 12. `GitHub - Create or Update Issue`
17
+ * 13. `GitHub - Add Issue or PR Comment`
18
+ * 14. `GitHub - Get Workflow Run and Logs`
19
+ *
20
+ * @module @memberjunction/core-actions/github
21
+ */
22
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
23
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
25
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
26
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
27
+ };
28
+ import { BaseAction } from '@memberjunction/actions';
29
+ import { RegisterClass } from '@memberjunction/global';
30
+ import { GitHubBaseAction } from './base-github.action.js';
31
+ // ============================================================================
32
+ // 1. GitHub - Get Repository Context
33
+ // ============================================================================
34
+ let GitHubGetRepositoryContextAction = class GitHubGetRepositoryContextAction extends GitHubBaseAction {
35
+ async InternalRunAction(params) {
36
+ try {
37
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
38
+ requireRepo: true,
39
+ permissions: { contents: 'read', metadata: 'read' },
40
+ });
41
+ const context = await client.GetRepositoryContext(coordinate.Owner, coordinate.Repo);
42
+ this.addOutputParam(params, 'RepositoryContext', context);
43
+ this.addOutputParam(params, 'DefaultBranch', context.DefaultBranch);
44
+ return {
45
+ Success: true,
46
+ ResultCode: 'SUCCESS',
47
+ Message: JSON.stringify(context, null, 2),
48
+ Params: params.Params,
49
+ };
50
+ }
51
+ catch (error) {
52
+ return this.handleGitHubError(error, params);
53
+ }
54
+ }
55
+ };
56
+ GitHubGetRepositoryContextAction = __decorate([
57
+ RegisterClass(BaseAction, 'GitHub - Get Repository Context')
58
+ ], GitHubGetRepositoryContextAction);
59
+ export { GitHubGetRepositoryContextAction };
60
+ // ============================================================================
61
+ // 2. GitHub - Read Repository File
62
+ // ============================================================================
63
+ let GitHubReadRepositoryFileAction = class GitHubReadRepositoryFileAction extends GitHubBaseAction {
64
+ async InternalRunAction(params) {
65
+ try {
66
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
67
+ requireRepo: true,
68
+ permissions: { contents: 'read', metadata: 'read' },
69
+ });
70
+ const singlePath = this.getStringParam(params, 'Path') ?? coordinate?.Subpath;
71
+ const multiplePaths = this.getStringArrayParam(params, 'Paths');
72
+ const targetPaths = multiplePaths && multiplePaths.length > 0
73
+ ? multiplePaths
74
+ : singlePath
75
+ ? [singlePath]
76
+ : [];
77
+ if (targetPaths.length === 0) {
78
+ return {
79
+ Success: false,
80
+ ResultCode: 'MISSING_PARAMETER',
81
+ Message: `Parameter 'Path' (or 'Paths') is required.`,
82
+ Params: params.Params,
83
+ };
84
+ }
85
+ const ref = this.getStringParam(params, 'Ref') ?? this.getStringParam(params, 'Branch');
86
+ const startLine = this.getNumericParam(params, 'StartLine');
87
+ const endLine = this.getNumericParam(params, 'EndLine');
88
+ const files = await client.ReadFiles(coordinate.Owner, coordinate.Repo, targetPaths, ref, startLine, endLine);
89
+ this.addOutputParam(params, 'Files', files);
90
+ if (files.length === 1) {
91
+ this.addOutputParam(params, 'Content', files[0].Content);
92
+ this.addOutputParam(params, 'Sha', files[0].Sha);
93
+ }
94
+ return {
95
+ Success: true,
96
+ ResultCode: 'SUCCESS',
97
+ Message: files.length === 1 ? files[0].Content : JSON.stringify(files, null, 2),
98
+ Params: params.Params,
99
+ };
100
+ }
101
+ catch (error) {
102
+ return this.handleGitHubError(error, params);
103
+ }
104
+ }
105
+ };
106
+ GitHubReadRepositoryFileAction = __decorate([
107
+ RegisterClass(BaseAction, 'GitHub - Read Repository File')
108
+ ], GitHubReadRepositoryFileAction);
109
+ export { GitHubReadRepositoryFileAction };
110
+ // ============================================================================
111
+ // 3. GitHub - List Repository Tree
112
+ // ============================================================================
113
+ let GitHubListRepositoryTreeAction = class GitHubListRepositoryTreeAction extends GitHubBaseAction {
114
+ async InternalRunAction(params) {
115
+ try {
116
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
117
+ requireRepo: true,
118
+ permissions: { contents: 'read', metadata: 'read' },
119
+ });
120
+ const ref = this.getStringParam(params, 'Ref') ?? this.getStringParam(params, 'Branch');
121
+ const pathPrefix = this.getStringParam(params, 'PathPrefix') ?? coordinate?.Subpath;
122
+ const globPattern = this.getStringParam(params, 'Glob');
123
+ const maxDepth = this.getNumericParam(params, 'MaxDepth');
124
+ const limit = this.getNumericParam(params, 'Limit', 500) ?? 500;
125
+ const result = await client.ListTree(coordinate.Owner, coordinate.Repo, ref, pathPrefix, globPattern, maxDepth, limit);
126
+ this.addOutputParam(params, 'Tree', result);
127
+ this.addOutputParam(params, 'Entries', result.Entries);
128
+ return {
129
+ Success: true,
130
+ ResultCode: 'SUCCESS',
131
+ Message: JSON.stringify(result, null, 2),
132
+ Params: params.Params,
133
+ };
134
+ }
135
+ catch (error) {
136
+ return this.handleGitHubError(error, params);
137
+ }
138
+ }
139
+ };
140
+ GitHubListRepositoryTreeAction = __decorate([
141
+ RegisterClass(BaseAction, 'GitHub - List Repository Tree')
142
+ ], GitHubListRepositoryTreeAction);
143
+ export { GitHubListRepositoryTreeAction };
144
+ // ============================================================================
145
+ // 4. GitHub - Search Code
146
+ // ============================================================================
147
+ let GitHubSearchCodeAction = class GitHubSearchCodeAction extends GitHubBaseAction {
148
+ async InternalRunAction(params) {
149
+ try {
150
+ const query = this.getStringParam(params, 'Query');
151
+ if (!query) {
152
+ return {
153
+ Success: false,
154
+ ResultCode: 'MISSING_PARAMETER',
155
+ Message: `Parameter 'Query' is required.`,
156
+ Params: params.Params,
157
+ };
158
+ }
159
+ const { client, auth, coordinate } = await this.resolveClientAndRepo(params, {
160
+ requireRepo: false,
161
+ permissions: { contents: 'read', metadata: 'read' },
162
+ });
163
+ const owner = coordinate?.Owner ?? this.getStringParam(params, 'Owner') ?? auth.DefaultOwner;
164
+ const repo = coordinate?.Repo ?? this.getStringParam(params, 'Repo');
165
+ const perPage = this.getNumericParam(params, 'PerPage', 25) ?? 25;
166
+ const result = await client.SearchCode(query, owner, repo, perPage);
167
+ this.addOutputParam(params, 'SearchResults', result);
168
+ this.addOutputParam(params, 'TotalCount', result.TotalCount);
169
+ return {
170
+ Success: true,
171
+ ResultCode: 'SUCCESS',
172
+ Message: JSON.stringify(result, null, 2),
173
+ Params: params.Params,
174
+ };
175
+ }
176
+ catch (error) {
177
+ return this.handleGitHubError(error, params);
178
+ }
179
+ }
180
+ };
181
+ GitHubSearchCodeAction = __decorate([
182
+ RegisterClass(BaseAction, 'GitHub - Search Code')
183
+ ], GitHubSearchCodeAction);
184
+ export { GitHubSearchCodeAction };
185
+ // ============================================================================
186
+ // 5. GitHub - Commit Files and Create PR
187
+ // ============================================================================
188
+ let GitHubCommitFilesAndCreatePRAction = class GitHubCommitFilesAndCreatePRAction extends GitHubBaseAction {
189
+ async InternalRunAction(params) {
190
+ try {
191
+ const branch = this.getStringParam(params, 'Branch') ?? this.getStringParam(params, 'HeadBranch');
192
+ const commitMessage = this.getStringParam(params, 'CommitMessage') ?? this.getStringParam(params, 'Message');
193
+ const prTitle = this.getStringParam(params, 'PRTitle') ?? this.getStringParam(params, 'Title') ?? commitMessage;
194
+ const files = this.getObjectParam(params, 'Files');
195
+ if (!branch) {
196
+ return {
197
+ Success: false,
198
+ ResultCode: 'MISSING_PARAMETER',
199
+ Message: `Parameter 'Branch' (or 'HeadBranch') is required.`,
200
+ Params: params.Params,
201
+ };
202
+ }
203
+ if (!commitMessage) {
204
+ return {
205
+ Success: false,
206
+ ResultCode: 'MISSING_PARAMETER',
207
+ Message: `Parameter 'CommitMessage' (or 'Message') is required.`,
208
+ Params: params.Params,
209
+ };
210
+ }
211
+ if (!files || !Array.isArray(files) || files.length === 0) {
212
+ return {
213
+ Success: false,
214
+ ResultCode: 'MISSING_PARAMETER',
215
+ Message: `Parameter 'Files' must be a non-empty array of { path, content, encoding?, delete? } objects.`,
216
+ Params: params.Params,
217
+ };
218
+ }
219
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
220
+ requireRepo: true,
221
+ permissions: { contents: 'write', pull_requests: 'write', issues: 'write', metadata: 'read' },
222
+ });
223
+ const baseBranch = this.getStringParam(params, 'BaseBranch') ?? this.getStringParam(params, 'Base');
224
+ const prBody = this.getStringParam(params, 'PRBody') ?? this.getStringParam(params, 'Body');
225
+ const draft = this.getBooleanParam(params, 'Draft');
226
+ const labels = this.getStringArrayParam(params, 'Labels');
227
+ const assignees = this.getStringArrayParam(params, 'Assignees');
228
+ const reviewers = this.getStringArrayParam(params, 'Reviewers');
229
+ const result = await client.CommitFilesAndCreatePR({
230
+ Commit: {
231
+ Owner: coordinate.Owner,
232
+ Repo: coordinate.Repo,
233
+ Branch: branch,
234
+ BaseBranch: baseBranch,
235
+ CreateBranch: true,
236
+ Message: commitMessage,
237
+ Files: files,
238
+ },
239
+ PRTitle: prTitle,
240
+ PRBody: prBody,
241
+ Draft: draft,
242
+ Labels: labels,
243
+ Assignees: assignees,
244
+ Reviewers: reviewers,
245
+ });
246
+ this.addOutputParam(params, 'CommitResult', result.CommitResult);
247
+ this.addOutputParam(params, 'PullRequest', result.PullRequest);
248
+ this.addOutputParam(params, 'PullNumber', result.PullRequest.Number);
249
+ this.addOutputParam(params, 'PullRequestUrl', result.PullRequest.HtmlUrl);
250
+ this.addOutputParam(params, 'CommitSha', result.CommitResult.CommitSha);
251
+ return {
252
+ Success: true,
253
+ ResultCode: 'SUCCESS',
254
+ Message: JSON.stringify(result, null, 2),
255
+ Params: params.Params,
256
+ };
257
+ }
258
+ catch (error) {
259
+ return this.handleGitHubError(error, params);
260
+ }
261
+ }
262
+ };
263
+ GitHubCommitFilesAndCreatePRAction = __decorate([
264
+ RegisterClass(BaseAction, 'GitHub - Commit Files and Create PR')
265
+ ], GitHubCommitFilesAndCreatePRAction);
266
+ export { GitHubCommitFilesAndCreatePRAction };
267
+ // ============================================================================
268
+ // 6. GitHub - Commit Files to Branch
269
+ // ============================================================================
270
+ let GitHubCommitFilesToBranchAction = class GitHubCommitFilesToBranchAction extends GitHubBaseAction {
271
+ async InternalRunAction(params) {
272
+ try {
273
+ const branch = this.getStringParam(params, 'Branch') ?? this.getStringParam(params, 'HeadBranch');
274
+ const message = this.getStringParam(params, 'Message') ?? this.getStringParam(params, 'CommitMessage');
275
+ const files = this.getObjectParam(params, 'Files');
276
+ if (!branch) {
277
+ return {
278
+ Success: false,
279
+ ResultCode: 'MISSING_PARAMETER',
280
+ Message: `Parameter 'Branch' is required.`,
281
+ Params: params.Params,
282
+ };
283
+ }
284
+ if (!message) {
285
+ return {
286
+ Success: false,
287
+ ResultCode: 'MISSING_PARAMETER',
288
+ Message: `Parameter 'Message' is required.`,
289
+ Params: params.Params,
290
+ };
291
+ }
292
+ if (!files || !Array.isArray(files) || files.length === 0) {
293
+ return {
294
+ Success: false,
295
+ ResultCode: 'MISSING_PARAMETER',
296
+ Message: `Parameter 'Files' must be a non-empty array of { path, content, encoding?, delete? } objects.`,
297
+ Params: params.Params,
298
+ };
299
+ }
300
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
301
+ requireRepo: true,
302
+ permissions: { contents: 'write', metadata: 'read' },
303
+ });
304
+ const baseBranch = this.getStringParam(params, 'BaseBranch');
305
+ const createBranch = this.getBooleanParam(params, 'CreateBranch', true);
306
+ const allowProtectedBranch = this.getBooleanParam(params, 'AllowProtectedBranch', false);
307
+ const result = await client.CommitFiles({
308
+ Owner: coordinate.Owner,
309
+ Repo: coordinate.Repo,
310
+ Branch: branch,
311
+ BaseBranch: baseBranch,
312
+ CreateBranch: createBranch,
313
+ Message: message,
314
+ Files: files,
315
+ AllowProtectedBranch: allowProtectedBranch,
316
+ });
317
+ this.addOutputParam(params, 'CommitResult', result);
318
+ this.addOutputParam(params, 'CommitSha', result.CommitSha);
319
+ this.addOutputParam(params, 'CommitUrl', result.CommitUrl);
320
+ return {
321
+ Success: true,
322
+ ResultCode: 'SUCCESS',
323
+ Message: JSON.stringify(result, null, 2),
324
+ Params: params.Params,
325
+ };
326
+ }
327
+ catch (error) {
328
+ return this.handleGitHubError(error, params);
329
+ }
330
+ }
331
+ };
332
+ GitHubCommitFilesToBranchAction = __decorate([
333
+ RegisterClass(BaseAction, 'GitHub - Commit Files to Branch')
334
+ ], GitHubCommitFilesToBranchAction);
335
+ export { GitHubCommitFilesToBranchAction };
336
+ // ============================================================================
337
+ // 7. GitHub - Get Pull Request Context
338
+ // ============================================================================
339
+ let GitHubGetPullRequestContextAction = class GitHubGetPullRequestContextAction extends GitHubBaseAction {
340
+ async InternalRunAction(params) {
341
+ try {
342
+ const pullNumber = this.getNumericParam(params, 'PullNumber') ?? this.getNumericParam(params, 'PRNumber');
343
+ if (!pullNumber) {
344
+ return {
345
+ Success: false,
346
+ ResultCode: 'MISSING_PARAMETER',
347
+ Message: `Parameter 'PullNumber' is required.`,
348
+ Params: params.Params,
349
+ };
350
+ }
351
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
352
+ requireRepo: true,
353
+ permissions: { contents: 'read', pull_requests: 'read', checks: 'read', metadata: 'read' },
354
+ });
355
+ const includePatches = this.getBooleanParam(params, 'IncludePatches', true) ?? true;
356
+ const context = await client.GetPullRequestContext(coordinate.Owner, coordinate.Repo, pullNumber, includePatches);
357
+ this.addOutputParam(params, 'PullRequestContext', context);
358
+ this.addOutputParam(params, 'PullRequest', context.PullRequest);
359
+ this.addOutputParam(params, 'CheckRuns', context.CheckRuns);
360
+ return {
361
+ Success: true,
362
+ ResultCode: 'SUCCESS',
363
+ Message: JSON.stringify(context, null, 2),
364
+ Params: params.Params,
365
+ };
366
+ }
367
+ catch (error) {
368
+ return this.handleGitHubError(error, params);
369
+ }
370
+ }
371
+ };
372
+ GitHubGetPullRequestContextAction = __decorate([
373
+ RegisterClass(BaseAction, 'GitHub - Get Pull Request Context')
374
+ ], GitHubGetPullRequestContextAction);
375
+ export { GitHubGetPullRequestContextAction };
376
+ // ============================================================================
377
+ // 8. GitHub - Create Pull Request
378
+ // ============================================================================
379
+ let GitHubCreatePullRequestAction = class GitHubCreatePullRequestAction extends GitHubBaseAction {
380
+ async InternalRunAction(params) {
381
+ try {
382
+ const title = this.getStringParam(params, 'Title');
383
+ const head = this.getStringParam(params, 'Head') ?? this.getStringParam(params, 'Branch');
384
+ if (!title || !head) {
385
+ return {
386
+ Success: false,
387
+ ResultCode: 'MISSING_PARAMETER',
388
+ Message: `Parameters 'Title' and 'Head' (source branch) are required.`,
389
+ Params: params.Params,
390
+ };
391
+ }
392
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
393
+ requireRepo: true,
394
+ permissions: { pull_requests: 'write', issues: 'write', metadata: 'read' },
395
+ });
396
+ const pr = await client.CreatePullRequest({
397
+ Owner: coordinate.Owner,
398
+ Repo: coordinate.Repo,
399
+ Title: title,
400
+ Body: this.getStringParam(params, 'Body'),
401
+ Head: head,
402
+ Base: this.getStringParam(params, 'Base'),
403
+ Draft: this.getBooleanParam(params, 'Draft'),
404
+ Labels: this.getStringArrayParam(params, 'Labels'),
405
+ Assignees: this.getStringArrayParam(params, 'Assignees'),
406
+ Reviewers: this.getStringArrayParam(params, 'Reviewers'),
407
+ });
408
+ this.addOutputParam(params, 'PullRequest', pr);
409
+ this.addOutputParam(params, 'PullNumber', pr.Number);
410
+ this.addOutputParam(params, 'PullRequestUrl', pr.HtmlUrl);
411
+ return {
412
+ Success: true,
413
+ ResultCode: 'SUCCESS',
414
+ Message: JSON.stringify(pr, null, 2),
415
+ Params: params.Params,
416
+ };
417
+ }
418
+ catch (error) {
419
+ return this.handleGitHubError(error, params);
420
+ }
421
+ }
422
+ };
423
+ GitHubCreatePullRequestAction = __decorate([
424
+ RegisterClass(BaseAction, 'GitHub - Create Pull Request')
425
+ ], GitHubCreatePullRequestAction);
426
+ export { GitHubCreatePullRequestAction };
427
+ // ============================================================================
428
+ // 9. GitHub - Submit Pull Request Review
429
+ // ============================================================================
430
+ let GitHubSubmitPullRequestReviewAction = class GitHubSubmitPullRequestReviewAction extends GitHubBaseAction {
431
+ async InternalRunAction(params) {
432
+ try {
433
+ const pullNumber = this.getNumericParam(params, 'PullNumber') ?? this.getNumericParam(params, 'PRNumber');
434
+ const rawEvent = (this.getStringParam(params, 'Event') ?? 'COMMENT').toUpperCase();
435
+ if (!pullNumber) {
436
+ return {
437
+ Success: false,
438
+ ResultCode: 'MISSING_PARAMETER',
439
+ Message: `Parameter 'PullNumber' is required.`,
440
+ Params: params.Params,
441
+ };
442
+ }
443
+ if (rawEvent !== 'APPROVE' && rawEvent !== 'REQUEST_CHANGES' && rawEvent !== 'COMMENT') {
444
+ return {
445
+ Success: false,
446
+ ResultCode: 'INVALID_PARAMETER',
447
+ Message: `Parameter 'Event' must be one of 'APPROVE', 'REQUEST_CHANGES', or 'COMMENT'.`,
448
+ Params: params.Params,
449
+ };
450
+ }
451
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
452
+ requireRepo: true,
453
+ permissions: { pull_requests: 'write', metadata: 'read' },
454
+ });
455
+ const comments = this.getObjectParam(params, 'Comments');
456
+ const review = await client.SubmitPullRequestReview({
457
+ Owner: coordinate.Owner,
458
+ Repo: coordinate.Repo,
459
+ PullNumber: pullNumber,
460
+ Event: rawEvent,
461
+ Body: this.getStringParam(params, 'Body'),
462
+ Comments: comments,
463
+ });
464
+ this.addOutputParam(params, 'Review', review);
465
+ this.addOutputParam(params, 'ReviewId', review.ReviewId);
466
+ return {
467
+ Success: true,
468
+ ResultCode: 'SUCCESS',
469
+ Message: JSON.stringify(review, null, 2),
470
+ Params: params.Params,
471
+ };
472
+ }
473
+ catch (error) {
474
+ return this.handleGitHubError(error, params);
475
+ }
476
+ }
477
+ };
478
+ GitHubSubmitPullRequestReviewAction = __decorate([
479
+ RegisterClass(BaseAction, 'GitHub - Submit Pull Request Review')
480
+ ], GitHubSubmitPullRequestReviewAction);
481
+ export { GitHubSubmitPullRequestReviewAction };
482
+ // ============================================================================
483
+ // 10. GitHub - Merge Pull Request
484
+ // ============================================================================
485
+ let GitHubMergePullRequestAction = class GitHubMergePullRequestAction extends GitHubBaseAction {
486
+ async InternalRunAction(params) {
487
+ try {
488
+ const pullNumber = this.getNumericParam(params, 'PullNumber') ?? this.getNumericParam(params, 'PRNumber');
489
+ if (!pullNumber) {
490
+ return {
491
+ Success: false,
492
+ ResultCode: 'MISSING_PARAMETER',
493
+ Message: `Parameter 'PullNumber' is required.`,
494
+ Params: params.Params,
495
+ };
496
+ }
497
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
498
+ requireRepo: true,
499
+ permissions: { contents: 'write', pull_requests: 'write', metadata: 'read' },
500
+ });
501
+ const rawMethod = (this.getStringParam(params, 'MergeMethod') ?? 'squash').toLowerCase();
502
+ const mergeMethod = rawMethod === 'merge' || rawMethod === 'rebase' ? rawMethod : 'squash';
503
+ const merged = await client.MergePullRequest({
504
+ Owner: coordinate.Owner,
505
+ Repo: coordinate.Repo,
506
+ PullNumber: pullNumber,
507
+ MergeMethod: mergeMethod,
508
+ CommitTitle: this.getStringParam(params, 'CommitTitle'),
509
+ CommitMessage: this.getStringParam(params, 'CommitMessage'),
510
+ Sha: this.getStringParam(params, 'Sha'),
511
+ });
512
+ this.addOutputParam(params, 'MergeResult', merged);
513
+ this.addOutputParam(params, 'Merged', merged.Merged);
514
+ this.addOutputParam(params, 'Sha', merged.Sha);
515
+ return {
516
+ Success: true,
517
+ ResultCode: 'SUCCESS',
518
+ Message: JSON.stringify(merged, null, 2),
519
+ Params: params.Params,
520
+ };
521
+ }
522
+ catch (error) {
523
+ return this.handleGitHubError(error, params);
524
+ }
525
+ }
526
+ };
527
+ GitHubMergePullRequestAction = __decorate([
528
+ RegisterClass(BaseAction, 'GitHub - Merge Pull Request')
529
+ ], GitHubMergePullRequestAction);
530
+ export { GitHubMergePullRequestAction };
531
+ // ============================================================================
532
+ // 11. GitHub - Search Issues and PRs
533
+ // ============================================================================
534
+ let GitHubSearchIssuesAndPRsAction = class GitHubSearchIssuesAndPRsAction extends GitHubBaseAction {
535
+ async InternalRunAction(params) {
536
+ try {
537
+ const query = this.getStringParam(params, 'Query');
538
+ if (!query) {
539
+ return {
540
+ Success: false,
541
+ ResultCode: 'MISSING_PARAMETER',
542
+ Message: `Parameter 'Query' is required.`,
543
+ Params: params.Params,
544
+ };
545
+ }
546
+ const { client, auth, coordinate } = await this.resolveClientAndRepo(params, {
547
+ requireRepo: false,
548
+ permissions: { issues: 'read', pull_requests: 'read', metadata: 'read' },
549
+ });
550
+ const owner = coordinate?.Owner ?? this.getStringParam(params, 'Owner') ?? auth.DefaultOwner;
551
+ const repo = coordinate?.Repo ?? this.getStringParam(params, 'Repo');
552
+ const perPage = this.getNumericParam(params, 'PerPage', 25) ?? 25;
553
+ const result = await client.SearchIssuesAndPRs({
554
+ Query: query,
555
+ Owner: owner,
556
+ Repo: repo,
557
+ PerPage: perPage,
558
+ });
559
+ this.addOutputParam(params, 'SearchResults', result);
560
+ this.addOutputParam(params, 'TotalCount', result.TotalCount);
561
+ return {
562
+ Success: true,
563
+ ResultCode: 'SUCCESS',
564
+ Message: JSON.stringify(result, null, 2),
565
+ Params: params.Params,
566
+ };
567
+ }
568
+ catch (error) {
569
+ return this.handleGitHubError(error, params);
570
+ }
571
+ }
572
+ };
573
+ GitHubSearchIssuesAndPRsAction = __decorate([
574
+ RegisterClass(BaseAction, 'GitHub - Search Issues and PRs')
575
+ ], GitHubSearchIssuesAndPRsAction);
576
+ export { GitHubSearchIssuesAndPRsAction };
577
+ // ============================================================================
578
+ // 12. GitHub - Create or Update Issue
579
+ // ============================================================================
580
+ let GitHubCreateOrUpdateIssueAction = class GitHubCreateOrUpdateIssueAction extends GitHubBaseAction {
581
+ async InternalRunAction(params) {
582
+ try {
583
+ const issueNumber = this.getNumericParam(params, 'IssueNumber');
584
+ const title = this.getStringParam(params, 'Title');
585
+ if (!issueNumber && !title) {
586
+ return {
587
+ Success: false,
588
+ ResultCode: 'MISSING_PARAMETER',
589
+ Message: `Parameter 'Title' is required when creating a new issue (or pass 'IssueNumber' to update an existing issue).`,
590
+ Params: params.Params,
591
+ };
592
+ }
593
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
594
+ requireRepo: true,
595
+ permissions: { issues: 'write', metadata: 'read' },
596
+ });
597
+ const rawState = this.getStringParam(params, 'State')?.toLowerCase();
598
+ const state = rawState === 'open' || rawState === 'closed' ? rawState : undefined;
599
+ const issue = await client.CreateOrUpdateIssue({
600
+ Owner: coordinate.Owner,
601
+ Repo: coordinate.Repo,
602
+ IssueNumber: issueNumber,
603
+ Title: title,
604
+ Body: this.getStringParam(params, 'Body'),
605
+ State: state,
606
+ Labels: this.getStringArrayParam(params, 'Labels'),
607
+ Assignees: this.getStringArrayParam(params, 'Assignees'),
608
+ });
609
+ this.addOutputParam(params, 'Issue', issue);
610
+ this.addOutputParam(params, 'IssueNumber', issue.Number);
611
+ this.addOutputParam(params, 'IssueUrl', issue.HtmlUrl);
612
+ return {
613
+ Success: true,
614
+ ResultCode: 'SUCCESS',
615
+ Message: JSON.stringify(issue, null, 2),
616
+ Params: params.Params,
617
+ };
618
+ }
619
+ catch (error) {
620
+ return this.handleGitHubError(error, params);
621
+ }
622
+ }
623
+ };
624
+ GitHubCreateOrUpdateIssueAction = __decorate([
625
+ RegisterClass(BaseAction, 'GitHub - Create or Update Issue')
626
+ ], GitHubCreateOrUpdateIssueAction);
627
+ export { GitHubCreateOrUpdateIssueAction };
628
+ // ============================================================================
629
+ // 13. GitHub - Add Issue or PR Comment
630
+ // ============================================================================
631
+ let GitHubAddCommentAction = class GitHubAddCommentAction extends GitHubBaseAction {
632
+ async InternalRunAction(params) {
633
+ try {
634
+ const issueNumber = this.getNumericParam(params, 'IssueNumber') ??
635
+ this.getNumericParam(params, 'PullNumber') ??
636
+ this.getNumericParam(params, 'Number');
637
+ const body = this.getStringParam(params, 'Body') ?? this.getStringParam(params, 'Comment');
638
+ if (!issueNumber || !body) {
639
+ return {
640
+ Success: false,
641
+ ResultCode: 'MISSING_PARAMETER',
642
+ Message: `Parameters 'IssueNumber' (or 'PullNumber') and 'Body' are required.`,
643
+ Params: params.Params,
644
+ };
645
+ }
646
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
647
+ requireRepo: true,
648
+ permissions: { issues: 'write', pull_requests: 'write', metadata: 'read' },
649
+ });
650
+ const comment = await client.AddComment({
651
+ Owner: coordinate.Owner,
652
+ Repo: coordinate.Repo,
653
+ IssueNumber: issueNumber,
654
+ Body: body,
655
+ });
656
+ this.addOutputParam(params, 'Comment', comment);
657
+ this.addOutputParam(params, 'CommentId', comment.CommentId);
658
+ this.addOutputParam(params, 'CommentUrl', comment.HtmlUrl);
659
+ return {
660
+ Success: true,
661
+ ResultCode: 'SUCCESS',
662
+ Message: JSON.stringify(comment, null, 2),
663
+ Params: params.Params,
664
+ };
665
+ }
666
+ catch (error) {
667
+ return this.handleGitHubError(error, params);
668
+ }
669
+ }
670
+ };
671
+ GitHubAddCommentAction = __decorate([
672
+ RegisterClass(BaseAction, 'GitHub - Add Issue or PR Comment')
673
+ ], GitHubAddCommentAction);
674
+ export { GitHubAddCommentAction };
675
+ // ============================================================================
676
+ // 14. GitHub - Get Workflow Run and Logs
677
+ // ============================================================================
678
+ let GitHubGetWorkflowRunAndLogsAction = class GitHubGetWorkflowRunAndLogsAction extends GitHubBaseAction {
679
+ async InternalRunAction(params) {
680
+ try {
681
+ const rawAction = (this.getStringParam(params, 'Action') ?? 'inspect').toLowerCase();
682
+ const mode = rawAction === 'rerun-failed' || rawAction === 'dispatch' ? rawAction : 'inspect';
683
+ const { client, coordinate } = await this.resolveClientAndRepo(params, {
684
+ requireRepo: true,
685
+ permissions: { actions: mode === 'inspect' ? 'read' : 'write', metadata: 'read' },
686
+ });
687
+ const result = await client.GetWorkflowRunAndLogs({
688
+ Owner: coordinate.Owner,
689
+ Repo: coordinate.Repo,
690
+ Action: mode,
691
+ RunId: this.getNumericParam(params, 'RunId'),
692
+ Branch: this.getStringParam(params, 'Branch'),
693
+ WorkflowIdOrFileName: this.getStringParam(params, 'WorkflowIdOrFileName'),
694
+ DispatchInputs: this.getObjectParam(params, 'DispatchInputs'),
695
+ IncludeFailedJobLogs: this.getBooleanParam(params, 'IncludeFailedJobLogs', true),
696
+ MaxLogCharsPerJob: this.getNumericParam(params, 'MaxLogCharsPerJob', 4000),
697
+ });
698
+ this.addOutputParam(params, 'WorkflowDiagnostics', result);
699
+ return {
700
+ Success: true,
701
+ ResultCode: 'SUCCESS',
702
+ Message: JSON.stringify(result, null, 2),
703
+ Params: params.Params,
704
+ };
705
+ }
706
+ catch (error) {
707
+ return this.handleGitHubError(error, params);
708
+ }
709
+ }
710
+ };
711
+ GitHubGetWorkflowRunAndLogsAction = __decorate([
712
+ RegisterClass(BaseAction, 'GitHub - Get Workflow Run and Logs')
713
+ ], GitHubGetWorkflowRunAndLogsAction);
714
+ export { GitHubGetWorkflowRunAndLogsAction };
715
+ //# sourceMappingURL=github-actions.js.map