edsger 0.30.3 → 0.30.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.
|
@@ -70,19 +70,19 @@ export async function fetchPRExecutionContext(featureId, verbose) {
|
|
|
70
70
|
logInfo(`Fetching PR execution context for feature: ${featureId}`);
|
|
71
71
|
}
|
|
72
72
|
const devBranchName = getDevBranchName(featureId);
|
|
73
|
+
// Fetch GitHub config and data in parallel (need token before remote branch check)
|
|
74
|
+
const [feature, pullRequests, githubConfig] = await Promise.all([
|
|
75
|
+
getFeature(featureId, verbose),
|
|
76
|
+
getPullRequests({ featureId, verbose }),
|
|
77
|
+
getGitHubConfig(featureId, verbose),
|
|
78
|
+
]);
|
|
73
79
|
// Verify dev branch exists
|
|
74
80
|
const localExists = branchExists(devBranchName);
|
|
75
|
-
const remoteExists = !localExists && remoteBranchExists(devBranchName);
|
|
81
|
+
const remoteExists = !localExists && remoteBranchExists(devBranchName, githubConfig.token);
|
|
76
82
|
if (!localExists && !remoteExists) {
|
|
77
83
|
throw new Error(`Development branch '${devBranchName}' does not exist. ` +
|
|
78
84
|
`The feature must have code on the dev branch before PR execution.`);
|
|
79
85
|
}
|
|
80
|
-
// Fetch GitHub config and data in parallel
|
|
81
|
-
const [feature, pullRequests, githubConfig] = await Promise.all([
|
|
82
|
-
getFeature(featureId, verbose),
|
|
83
|
-
getPullRequests({ featureId, verbose }),
|
|
84
|
-
getGitHubConfig(featureId, verbose),
|
|
85
|
-
]);
|
|
86
86
|
// If branch only exists on remote, fetch it (using credential helper)
|
|
87
87
|
if (!localExists && remoteExists) {
|
|
88
88
|
if (verbose) {
|
|
@@ -76,20 +76,20 @@ export async function fetchPRSplittingContext(featureId, verbose, replaceExistin
|
|
|
76
76
|
logInfo(`Fetching PR splitting context for feature: ${featureId}`);
|
|
77
77
|
}
|
|
78
78
|
const devBranchName = getDevBranchName(featureId);
|
|
79
|
-
//
|
|
80
|
-
const localExists = branchExists(devBranchName);
|
|
81
|
-
const remoteExists = !localExists && remoteBranchExists(devBranchName);
|
|
82
|
-
if (!localExists && !remoteExists) {
|
|
83
|
-
throw new Error(`Development branch '${devBranchName}' does not exist. ` +
|
|
84
|
-
`The feature must have code on the dev branch before PR splitting.`);
|
|
85
|
-
}
|
|
86
|
-
// Fetch database data and GitHub config in parallel
|
|
79
|
+
// Fetch database data and GitHub config in parallel (need token before remote branch check)
|
|
87
80
|
const [feature, existing_branches, existing_pull_requests, githubConfig] = await Promise.all([
|
|
88
81
|
getFeature(featureId, verbose),
|
|
89
82
|
getBranches({ featureId, verbose }).catch(() => []),
|
|
90
83
|
getPullRequests({ featureId, verbose }).catch(() => []),
|
|
91
84
|
getGitHubConfig(featureId, verbose),
|
|
92
85
|
]);
|
|
86
|
+
// Verify dev branch exists
|
|
87
|
+
const localExists = branchExists(devBranchName);
|
|
88
|
+
const remoteExists = !localExists && remoteBranchExists(devBranchName, githubConfig.token);
|
|
89
|
+
if (!localExists && !remoteExists) {
|
|
90
|
+
throw new Error(`Development branch '${devBranchName}' does not exist. ` +
|
|
91
|
+
`The feature must have code on the dev branch before PR splitting.`);
|
|
92
|
+
}
|
|
93
93
|
// If branch only exists on remote, fetch it (using credential helper)
|
|
94
94
|
if (!localExists && remoteExists) {
|
|
95
95
|
if (verbose) {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Creates pull requests from feature branches after successful testing
|
|
4
4
|
*/
|
|
5
5
|
import { Octokit } from '@octokit/rest';
|
|
6
|
-
import { execSync } from 'child_process';
|
|
7
|
-
import { gitPush } from '../../utils/git-push.js';
|
|
6
|
+
import { execSync, execFileSync } from 'child_process';
|
|
7
|
+
import { gitPush, buildCredentialArgs } from '../../utils/git-push.js';
|
|
8
8
|
// GitHub PR title best practice: keep under 72 characters
|
|
9
9
|
const MAX_PR_TITLE_LENGTH = 72;
|
|
10
10
|
const PR_TITLE_PREFIX = 'feat: ';
|
|
@@ -67,7 +67,7 @@ const discardUncommittedChanges = (verbose) => {
|
|
|
67
67
|
* @param branch - The branch to switch to
|
|
68
68
|
* @param verbose - Whether to log verbose output
|
|
69
69
|
*/
|
|
70
|
-
const switchToBranch = (branch, verbose) => {
|
|
70
|
+
const switchToBranch = (branch, verbose, githubToken) => {
|
|
71
71
|
try {
|
|
72
72
|
// First check if branch exists locally
|
|
73
73
|
if (!branchExists(branch)) {
|
|
@@ -77,7 +77,8 @@ const switchToBranch = (branch, verbose) => {
|
|
|
77
77
|
}
|
|
78
78
|
try {
|
|
79
79
|
// Fetch to get latest remote refs
|
|
80
|
-
|
|
80
|
+
const credArgs = buildCredentialArgs(githubToken);
|
|
81
|
+
execFileSync('git', [...credArgs, 'fetch', 'origin'], { encoding: 'utf-8', stdio: 'pipe' });
|
|
81
82
|
// Check if remote branch exists
|
|
82
83
|
execSync(`git rev-parse --verify origin/${branch}`, {
|
|
83
84
|
encoding: 'utf-8',
|
|
@@ -230,7 +231,7 @@ export async function createPullRequest(config, feature) {
|
|
|
230
231
|
if (verbose) {
|
|
231
232
|
console.log(`⚠️ Currently on ${baseBranch} branch, switching to ${devBranch}`);
|
|
232
233
|
}
|
|
233
|
-
switchToBranch(devBranch, verbose);
|
|
234
|
+
switchToBranch(devBranch, verbose, githubToken);
|
|
234
235
|
currentBranch = devBranch;
|
|
235
236
|
}
|
|
236
237
|
// Extract feature ID from current branch (dev/feature-id)
|
|
@@ -387,7 +387,7 @@ export function switchToFeatureBranchAndRebase(featureBranch, baseBranch = 'main
|
|
|
387
387
|
// Switch to feature branch (will create if doesn't exist)
|
|
388
388
|
// Default behavior now checks remote first (handles multi-clone scenarios)
|
|
389
389
|
if (getCurrentBranch() !== featureBranch) {
|
|
390
|
-
switchToBranch(featureBranch, verbose);
|
|
390
|
+
switchToBranch(featureBranch, verbose, { githubToken });
|
|
391
391
|
}
|
|
392
392
|
// Sync with remote feature branch if it exists and local branch needs updating
|
|
393
393
|
// This handles the case where local branch exists but is behind remote
|
|
@@ -732,7 +732,7 @@ export async function switchToFeatureBranchAndRebaseAsync(options) {
|
|
|
732
732
|
// Switch to feature branch (will create if doesn't exist)
|
|
733
733
|
// Default behavior now checks remote first (handles multi-clone scenarios)
|
|
734
734
|
if (getCurrentBranch() !== featureBranch) {
|
|
735
|
-
switchToBranch(featureBranch, verbose);
|
|
735
|
+
switchToBranch(featureBranch, verbose, { githubToken });
|
|
736
736
|
}
|
|
737
737
|
// Sync with remote feature branch if it exists and local branch needs updating
|
|
738
738
|
// This handles the case where local branch exists but is behind remote
|