patchrelay 0.35.8 → 0.35.9
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/build-info.json
CHANGED
package/dist/github-app-token.js
CHANGED
|
@@ -203,8 +203,10 @@ async function resolveBotIdentity(jwt) {
|
|
|
203
203
|
throw new Error(`Failed to fetch bot user ${botLogin} (${userResponse.status}): ${body}`);
|
|
204
204
|
}
|
|
205
205
|
const user = await userResponse.json();
|
|
206
|
+
const { tokenFile } = getGitHubAppPaths();
|
|
206
207
|
return {
|
|
207
208
|
name: user.login,
|
|
208
209
|
email: `${user.id}+${user.login}@users.noreply.github.com`,
|
|
210
|
+
tokenFile,
|
|
209
211
|
};
|
|
210
212
|
}
|
package/dist/run-orchestrator.js
CHANGED
|
@@ -220,11 +220,17 @@ export class RunOrchestrator {
|
|
|
220
220
|
try {
|
|
221
221
|
// Ensure worktree
|
|
222
222
|
await this.worktreeManager.ensureIssueWorktree(project.repoPath, project.worktreeRoot, worktreePath, branchName, { allowExistingOutsideRoot: issue.branchName !== undefined });
|
|
223
|
-
// Set bot git identity when GitHub App is configured
|
|
223
|
+
// Set bot git identity and push credentials when GitHub App is configured.
|
|
224
|
+
// This ensures commits are authored by and pushes are authenticated as
|
|
225
|
+
// patchrelay[bot], not the system user.
|
|
224
226
|
if (this.botIdentity) {
|
|
225
227
|
const gitBin = this.config.runner.gitBin;
|
|
226
228
|
await execCommand(gitBin, ["-C", worktreePath, "config", "user.name", this.botIdentity.name], { timeoutMs: 5_000 });
|
|
227
229
|
await execCommand(gitBin, ["-C", worktreePath, "config", "user.email", this.botIdentity.email], { timeoutMs: 5_000 });
|
|
230
|
+
// Override credential helper to use the App installation token for git push.
|
|
231
|
+
// The helper script reads the token file and returns it as the password.
|
|
232
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=$(cat ${this.botIdentity.tokenFile})"; }; f`;
|
|
233
|
+
await execCommand(gitBin, ["-C", worktreePath, "config", "credential.helper", credentialHelper], { timeoutMs: 5_000 });
|
|
228
234
|
}
|
|
229
235
|
// Freshen the worktree: fetch + rebase onto latest base branch.
|
|
230
236
|
// This prevents branch contamination when local main has drifted
|