git-stack-cli 2.7.7 → 2.7.8
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/dist/js/index.js +57 -57
- package/package.json +1 -1
- package/src/app/SyncGithub.tsx +41 -14
- package/src/core/github.tsx +9 -4
package/package.json
CHANGED
package/src/app/SyncGithub.tsx
CHANGED
|
@@ -169,10 +169,26 @@ async function run() {
|
|
|
169
169
|
// avoid accidentally pointing to orphaned parent commit
|
|
170
170
|
// should hopefully fix issues where a PR includes a bunch of commits after pushing
|
|
171
171
|
if (group.pr) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
// only update base if it is different
|
|
173
|
+
// github api started returning errors here on 2025-12-08
|
|
174
|
+
//
|
|
175
|
+
// ```
|
|
176
|
+
// [2025-12-08 17:54:44.114] [start] gh pr edit noah/cua-images-chatgpt-prod-tags---4h0tk3liqmmplu --base master
|
|
177
|
+
// [2025-12-08 17:54:45.935] [end] gh pr edit noah/cua-images-chatgpt-prod-tags---4h0tk3liqmmplu --base master (exit_code=1 duration=1.8s)
|
|
178
|
+
// [2025-12-08 17:54:45.937] GraphQL: A pull request already exists for base branch 'master' and head branch 'noah/cua-images-chatgpt-prod-tags---4h0tk3liqmmplu' (updatePullRequest)
|
|
179
|
+
//
|
|
180
|
+
// [2025-12-08 17:54:45.938] gh pr edit noah/cua-images-chatgpt-prod-tags---4h0tk3liqmmplu --base master (exit_code=1 duration=1.8s)
|
|
181
|
+
// GraphQL: A pull request already exists for base branch 'master' and head branch 'noah/cua-images-chatgpt-prod-tags---4h0tk3liqmmplu' (updatePullRequest)
|
|
182
|
+
// gh pr edit noah/cua-images-chatgpt-prod-tags---4h0tk3liqmmplu --base master (exit_code=1 duration=1.8s)
|
|
183
|
+
// Unable to sync.
|
|
184
|
+
// ```
|
|
185
|
+
//
|
|
186
|
+
if (`origin/${group.pr.baseRefName}` !== master_branch) {
|
|
187
|
+
await github.pr_edit({
|
|
188
|
+
branch: group.id,
|
|
189
|
+
base: master_branch,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
176
192
|
}
|
|
177
193
|
}
|
|
178
194
|
|
|
@@ -184,16 +200,27 @@ async function run() {
|
|
|
184
200
|
const selected_url = get_group_url(group);
|
|
185
201
|
|
|
186
202
|
if (group.pr) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
body:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
203
|
+
if (`origin/${group.pr.baseRefName}` !== master_branch) {
|
|
204
|
+
// ensure base matches pr in github
|
|
205
|
+
await github.pr_edit({
|
|
206
|
+
branch: group.id,
|
|
207
|
+
base: group.base,
|
|
208
|
+
body: StackSummaryTable.write({
|
|
209
|
+
body: group.pr.body,
|
|
210
|
+
pr_url_list,
|
|
211
|
+
selected_url,
|
|
212
|
+
}),
|
|
213
|
+
});
|
|
214
|
+
} else {
|
|
215
|
+
await github.pr_edit({
|
|
216
|
+
branch: group.id,
|
|
217
|
+
body: StackSummaryTable.write({
|
|
218
|
+
body: group.pr.body,
|
|
219
|
+
pr_url_list,
|
|
220
|
+
selected_url,
|
|
221
|
+
}),
|
|
222
|
+
});
|
|
223
|
+
}
|
|
197
224
|
} else {
|
|
198
225
|
// create pr in github
|
|
199
226
|
const pr_url = await github.pr_create({
|
package/src/core/github.tsx
CHANGED
|
@@ -162,13 +162,17 @@ export async function pr_create(args: CreatePullRequestArgs) {
|
|
|
162
162
|
|
|
163
163
|
type EditPullRequestArgs = {
|
|
164
164
|
branch: string;
|
|
165
|
-
base
|
|
165
|
+
base?: string;
|
|
166
166
|
body?: string;
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
export async function pr_edit(args: EditPullRequestArgs) {
|
|
170
|
-
const
|
|
171
|
-
|
|
170
|
+
const command_parts = [`gh pr edit ${args.branch}`];
|
|
171
|
+
|
|
172
|
+
if (args.base) {
|
|
173
|
+
const base = args.base.replace(/^origin\//, "");
|
|
174
|
+
command_parts.push(`--base ${base}`);
|
|
175
|
+
}
|
|
172
176
|
|
|
173
177
|
let body_file: string | undefined;
|
|
174
178
|
|
|
@@ -279,7 +283,8 @@ async function write_body_file(args: EditPullRequestArgs) {
|
|
|
279
283
|
// ensure unique filename is safe for filesystem
|
|
280
284
|
// base (group id) might contain slashes, e.g. dev/magus/gs-3cmrMBSUj
|
|
281
285
|
// the flashes would mess up the filesystem path to this file
|
|
282
|
-
|
|
286
|
+
let base = args.base || "master";
|
|
287
|
+
base = base.replace(/^origin\//, "");
|
|
283
288
|
let tmp_filename = safe_filename(`git-stack-body-${base}`);
|
|
284
289
|
|
|
285
290
|
const temp_path = path.join(await get_tmp_dir(), tmp_filename);
|