edsger 0.13.3 → 0.13.4

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.
@@ -409,42 +409,42 @@ export async function syncFeatBranchWithMain(featureId, githubToken, owner, repo
409
409
  branch: featBranch,
410
410
  });
411
411
  const featSha = featBranchData.commit.sha;
412
- // Check if feat branch is already up to date (same as main or ahead)
413
- // We need to merge main into feat to keep it updated
412
+ // Check if feat branch is already up to date
414
413
  if (verbose) {
415
414
  logInfo(`📥 Syncing ${featBranch} with ${baseBranch}...`);
416
415
  logInfo(` ${baseBranch} SHA: ${mainSha.substring(0, 7)}`);
417
416
  logInfo(` ${featBranch} SHA: ${featSha.substring(0, 7)}`);
418
417
  }
419
- // Use GitHub merge API to merge main into feat branch
418
+ // If already at the same SHA, no need to update
419
+ if (mainSha === featSha) {
420
+ if (verbose) {
421
+ logInfo(`ℹ️ ${featBranch} is already up to date with ${baseBranch}`);
422
+ }
423
+ return true;
424
+ }
425
+ // Use git.updateRef to fast-forward feat branch to main's SHA
426
+ // This avoids creating a merge commit
420
427
  try {
421
- await octokit.repos.merge({
428
+ await octokit.git.updateRef({
422
429
  owner,
423
430
  repo,
424
- base: featBranch,
425
- head: baseBranch,
426
- commit_message: `chore: sync ${featBranch} with ${baseBranch}`,
431
+ ref: `heads/${featBranch}`,
432
+ sha: mainSha,
433
+ force: true, // Force update since feat branch may have diverged
427
434
  });
428
435
  if (verbose) {
429
- logInfo(`✅ Successfully synced ${featBranch} with ${baseBranch}`);
436
+ logInfo(`✅ Successfully synced ${featBranch} to ${baseBranch} (${mainSha.substring(0, 7)})`);
430
437
  }
431
438
  }
432
- catch (mergeError) {
433
- // 409 means nothing to merge (already up to date)
434
- if (mergeError.status === 409) {
435
- if (verbose) {
436
- logInfo(`ℹ️ ${featBranch} is already up to date with ${baseBranch}`);
437
- }
438
- return true;
439
- }
440
- // 404 means branch doesn't exist (shouldn't happen since we checked above)
441
- if (mergeError.status === 404) {
439
+ catch (updateError) {
440
+ // 422 means the ref doesn't exist or other validation error
441
+ if (updateError.status === 422 || updateError.status === 404) {
442
442
  if (verbose) {
443
- logInfo(`ℹ️ ${featBranch} branch not found, skipping sync`);
443
+ logInfo(`ℹ️ Could not update ${featBranch} ref, skipping sync`);
444
444
  }
445
445
  return true;
446
446
  }
447
- throw mergeError;
447
+ throw updateError;
448
448
  }
449
449
  return true;
450
450
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edsger",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "edsger": "dist/index.js"