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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "2.7.7",
3
+ "version": "2.7.8",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
@@ -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
- await github.pr_edit({
173
- branch: group.id,
174
- base: master_branch,
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
- // ensure base matches pr in github
188
- await github.pr_edit({
189
- branch: group.id,
190
- base: group.base,
191
- body: StackSummaryTable.write({
192
- body: group.pr.body,
193
- pr_url_list,
194
- selected_url,
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({
@@ -162,13 +162,17 @@ export async function pr_create(args: CreatePullRequestArgs) {
162
162
 
163
163
  type EditPullRequestArgs = {
164
164
  branch: string;
165
- base: string;
165
+ base?: string;
166
166
  body?: string;
167
167
  };
168
168
 
169
169
  export async function pr_edit(args: EditPullRequestArgs) {
170
- const base = args.base.replace(/^origin\//, "");
171
- const command_parts = [`gh pr edit ${args.branch} --base ${base}`];
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
- const base = args.base.replace(/^origin\//, "");
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);