Skip to content

Commit

Permalink
Add repo name to worktree path (#7)
Browse files Browse the repository at this point in the history
This addresses two issues: 1) no longer assume that the user is working
from the root directory of the repository, and 2) put the repo name in
the working tree path to avoid any potential conflicts from backports
from other repositories.

Signed-off-by: Andrew Ross <andrross@amazon.com>
  • Loading branch information
andrross authored Jun 7, 2023
1 parent a82e65e commit dc45320
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/backport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,24 @@ const getFailedBackportCommentBody = ({
commitSha,
errorMessage,
head,
repo,
}: {
base: string;
commitSha: string;
errorMessage: string;
head: string;
repo: string;
}) => {
const worktreePath = `../.worktrees/backport-${base}`;
const worktreePath = `../.worktrees/${repo}/backport-${base}`;
return [
`The backport to \`${base}\` failed:`,
"```",
errorMessage,
"```",
"To backport manually, run these commands in your terminal:",
"```bash",
"# Navigate to the root of your repository",
"cd $(git rev-parse --show-toplevel)",
"# Fetch latest updates from GitHub",
"git fetch",
"# Create a new working tree",
Expand Down Expand Up @@ -329,6 +333,7 @@ const backport = async ({
commitSha: mergeCommitSha,
errorMessage: error.message,
head,
repo
}),
issue_number: number,
owner,
Expand Down

0 comments on commit dc45320

Please sign in to comment.