git-workspace-service 0.3.3 → 0.4.0

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/index.d.cts CHANGED
@@ -295,6 +295,11 @@ interface WorkspaceConfig {
295
295
  * Hook to run when workspace operations complete
296
296
  */
297
297
  onComplete?: CompletionHook;
298
+ /**
299
+ * Exact branch name to use. If provided, overrides the auto-generated
300
+ * name from prefix/execution/task. The branch is still created from baseBranch.
301
+ */
302
+ branchName?: string;
298
303
  }
299
304
  /**
300
305
  * A provisioned git workspace
package/dist/index.d.ts CHANGED
@@ -295,6 +295,11 @@ interface WorkspaceConfig {
295
295
  * Hook to run when workspace operations complete
296
296
  */
297
297
  onComplete?: CompletionHook;
298
+ /**
299
+ * Exact branch name to use. If provided, overrides the auto-generated
300
+ * name from prefix/execution/task. The branch is still created from baseBranch.
301
+ */
302
+ branchName?: string;
298
303
  }
299
304
  /**
300
305
  * A provisioned git workspace
package/dist/index.js CHANGED
@@ -188,6 +188,23 @@ async function configureCredentialHelper(workspacePath, context) {
188
188
  const helperScriptPath = path.join(helperDir, "git-credential-helper");
189
189
  const helperScript = createShellCredentialHelperScript(contextFilePath);
190
190
  await fs.promises.writeFile(helperScriptPath, helperScript, { mode: 448 });
191
+ const gitignorePath = path.join(workspacePath, ".gitignore");
192
+ const entry = ".git-workspace/";
193
+ try {
194
+ let content = "";
195
+ try {
196
+ content = await fs.promises.readFile(gitignorePath, "utf-8");
197
+ } catch {
198
+ }
199
+ if (!content.includes(entry)) {
200
+ const suffix = content.length > 0 && !content.endsWith("\n") ? `
201
+ ${entry}
202
+ ` : `${entry}
203
+ `;
204
+ await fs.promises.writeFile(gitignorePath, content + suffix);
205
+ }
206
+ } catch {
207
+ }
191
208
  return helperScriptPath;
192
209
  }
193
210
  async function updateCredentials(workspacePath, newToken, newExpiresAt) {
@@ -322,7 +339,12 @@ var WorkspaceService = class {
322
339
  });
323
340
  }
324
341
  }
325
- const branchInfo = createBranchInfo(
342
+ const branchInfo = config.branchName ? {
343
+ name: config.branchName,
344
+ executionId: config.execution.id,
345
+ baseBranch: config.baseBranch,
346
+ createdAt: /* @__PURE__ */ new Date()
347
+ } : createBranchInfo(
326
348
  {
327
349
  executionId: config.execution.id,
328
350
  role: config.task.role,