@juangcarmona/lighthouse-sdlc 0.22.9 → 0.22.10
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/package.json +1 -1
- package/src/implementation.mjs +13 -1
package/package.json
CHANGED
package/src/implementation.mjs
CHANGED
|
@@ -267,7 +267,19 @@ async function writeImplementationPullRequest(api, { snapshot, changes, body, ru
|
|
|
267
267
|
const tree = verificationRefresh ? commit.tree : await api('git/trees', 'POST', { base_tree: commit.tree.sha, tree: entries });
|
|
268
268
|
if (synchronization && tree.sha !== checkedTree) throw Error('Synchronized publication differs from the independently checked tree');
|
|
269
269
|
const message = verificationRefresh ? `chore: refresh verification for issue #${snapshot.issue}\n\nLighthouse-CI-Base: ${snapshot.baseRevision}` : `feat: implement issue #${snapshot.issue}`;
|
|
270
|
-
const
|
|
270
|
+
const commitBody = { message, tree: tree.sha, parents: synchronization ? [snapshot.sourceRevision, snapshot.baseRevision] : [snapshot.sourceRevision] };
|
|
271
|
+
let created;
|
|
272
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
273
|
+
try { created = await api('git/commits', 'POST', commitBody); break; }
|
|
274
|
+
catch (error) {
|
|
275
|
+
// Recover only this explicit refusal, after observing the immutable tree; uncertain writes remain terminal.
|
|
276
|
+
if (attempt === 2 || error.status !== 422 || error.message !== 'GitHub POST git/commits: 422: Tree SHA does not exist' || !/^[a-f0-9]{40}$/.test(tree.sha ?? '')) throw error;
|
|
277
|
+
if ((await api(`git/trees/${tree.sha}`, 'GET', undefined, true))?.sha !== tree.sha) throw error;
|
|
278
|
+
await setTimeout(250 * 2 ** attempt);
|
|
279
|
+
await beforeWrite();
|
|
280
|
+
await checkEpicBase();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
271
283
|
await beforeWrite();
|
|
272
284
|
await checkEpicBase();
|
|
273
285
|
if (snapshot.productAlignment?.parent.pullRequest) {
|