edsger 0.21.0 â 0.21.1
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.
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { getFeature } from '../../api/features/index.js';
|
|
5
5
|
import { getGitHubConfig } from '../../api/github.js';
|
|
6
6
|
import { createPullRequest } from './creator.js';
|
|
7
|
-
import { logFeaturePhaseEvent } from '../../services/audit-logs.js';
|
|
8
7
|
import { getCurrentBranch, updateBranch, } from '../../services/branches.js';
|
|
9
8
|
/**
|
|
10
9
|
* Create pull request for successful feature implementation
|
|
@@ -14,33 +13,12 @@ export async function handlePullRequestCreation({ featureId, results, testingRes
|
|
|
14
13
|
if (verbose) {
|
|
15
14
|
console.log('đ Creating pull request for successful feature...');
|
|
16
15
|
}
|
|
17
|
-
// Log phase start
|
|
18
|
-
await logFeaturePhaseEvent({
|
|
19
|
-
featureId,
|
|
20
|
-
eventType: 'phase_started',
|
|
21
|
-
phase: 'pull_request',
|
|
22
|
-
result: 'info',
|
|
23
|
-
metadata: {
|
|
24
|
-
timestamp: new Date().toISOString(),
|
|
25
|
-
},
|
|
26
|
-
}, verbose);
|
|
27
16
|
// Get feature details for PR creation
|
|
28
17
|
const feature = await getFeature(featureId, verbose);
|
|
29
18
|
if (!feature) {
|
|
30
19
|
if (verbose) {
|
|
31
20
|
console.log('â ī¸ Could not fetch feature details for pull request creation');
|
|
32
21
|
}
|
|
33
|
-
// Log phase failure
|
|
34
|
-
await logFeaturePhaseEvent({
|
|
35
|
-
featureId,
|
|
36
|
-
eventType: 'phase_failed',
|
|
37
|
-
phase: 'pull_request',
|
|
38
|
-
result: 'error',
|
|
39
|
-
errorMessage: 'Could not fetch feature details',
|
|
40
|
-
metadata: {
|
|
41
|
-
timestamp: new Date().toISOString(),
|
|
42
|
-
},
|
|
43
|
-
}, verbose);
|
|
44
22
|
return false;
|
|
45
23
|
}
|
|
46
24
|
// Get current branch for the feature
|
|
@@ -59,20 +37,6 @@ export async function handlePullRequestCreation({ featureId, results, testingRes
|
|
|
59
37
|
console.log(`âšī¸ Pull request already exists: ${currentBranch.pull_request_url}`);
|
|
60
38
|
console.log('â
Skipping PR creation, using existing pull request');
|
|
61
39
|
}
|
|
62
|
-
// Log phase completion with existing PR
|
|
63
|
-
await logFeaturePhaseEvent({
|
|
64
|
-
featureId,
|
|
65
|
-
eventType: 'phase_completed',
|
|
66
|
-
phase: 'pull_request',
|
|
67
|
-
result: 'success',
|
|
68
|
-
metadata: {
|
|
69
|
-
pull_request_url: currentBranch.pull_request_url,
|
|
70
|
-
branch_id: currentBranch.id,
|
|
71
|
-
skipped: true,
|
|
72
|
-
reason: 'Pull request already exists',
|
|
73
|
-
timestamp: new Date().toISOString(),
|
|
74
|
-
},
|
|
75
|
-
}, verbose);
|
|
76
40
|
return true;
|
|
77
41
|
}
|
|
78
42
|
// Get GitHub configuration from product developer settings
|
|
@@ -85,17 +49,6 @@ export async function handlePullRequestCreation({ featureId, results, testingRes
|
|
|
85
49
|
console.log('â ī¸ GitHub configuration not found. Skipping pull request creation.');
|
|
86
50
|
console.log(` ${githubConfig.message || 'Please configure a developer with GitHub App installation in the product settings.'}`);
|
|
87
51
|
}
|
|
88
|
-
// Log phase failure
|
|
89
|
-
await logFeaturePhaseEvent({
|
|
90
|
-
featureId,
|
|
91
|
-
eventType: 'phase_failed',
|
|
92
|
-
phase: 'pull_request',
|
|
93
|
-
result: 'error',
|
|
94
|
-
errorMessage: githubConfig.message || 'GitHub configuration not found',
|
|
95
|
-
metadata: {
|
|
96
|
-
timestamp: new Date().toISOString(),
|
|
97
|
-
},
|
|
98
|
-
}, verbose);
|
|
99
52
|
return false;
|
|
100
53
|
}
|
|
101
54
|
const { token: githubToken, owner: githubOwner, repo: githubRepo, } = githubConfig;
|
|
@@ -141,19 +94,6 @@ export async function handlePullRequestCreation({ featureId, results, testingRes
|
|
|
141
94
|
}
|
|
142
95
|
}
|
|
143
96
|
}
|
|
144
|
-
// Log phase completion
|
|
145
|
-
await logFeaturePhaseEvent({
|
|
146
|
-
featureId,
|
|
147
|
-
eventType: 'phase_completed',
|
|
148
|
-
phase: 'pull_request',
|
|
149
|
-
result: 'success',
|
|
150
|
-
metadata: {
|
|
151
|
-
pull_request_url: prResult.pullRequestUrl,
|
|
152
|
-
pull_request_number: prResult.pullRequestNumber,
|
|
153
|
-
branch_id: currentBranch?.id,
|
|
154
|
-
timestamp: new Date().toISOString(),
|
|
155
|
-
},
|
|
156
|
-
}, verbose);
|
|
157
97
|
if (verbose) {
|
|
158
98
|
console.log(`â
Pull request created${currentBranch ? ' and branch updated' : ''}`);
|
|
159
99
|
}
|
|
@@ -163,17 +103,6 @@ export async function handlePullRequestCreation({ featureId, results, testingRes
|
|
|
163
103
|
if (verbose) {
|
|
164
104
|
console.log(`â ī¸ Pull request creation failed: ${prResult.error}`);
|
|
165
105
|
}
|
|
166
|
-
// Log phase failure
|
|
167
|
-
await logFeaturePhaseEvent({
|
|
168
|
-
featureId,
|
|
169
|
-
eventType: 'phase_failed',
|
|
170
|
-
phase: 'pull_request',
|
|
171
|
-
result: 'error',
|
|
172
|
-
errorMessage: prResult.error,
|
|
173
|
-
metadata: {
|
|
174
|
-
timestamp: new Date().toISOString(),
|
|
175
|
-
},
|
|
176
|
-
}, verbose);
|
|
177
106
|
return false;
|
|
178
107
|
}
|
|
179
108
|
}
|