- git status/git add ignore the action's own clone
- git checkout <branch> auto‑creates the local branch with upstream tracking
This commit is contained in:
Alpha Nerd 2026-05-11 21:20:45 +02:00
parent ca8abdf8b9
commit 4585d60516
Signed by: alpha-nerd
SSH key fingerprint: SHA256:QkkAgVoYi9TQ0UKPkiKSfnerZy2h4qhi3SVPXJmBN+M

View file

@ -673,6 +673,9 @@ async function configureGitIdentity() {
console.log("Configuring git identity...")
await $`git config --global user.name "opencode-agent[bot]"`
await $`git config --global user.email "opencode-agent[bot]@users.noreply.${forgejoHost}"`
const excludeFile = (await $`git rev-parse --git-path info/exclude`.text()).trim()
await $`echo ".opencode-action/" >> ${excludeFile}`
}
async function checkoutNewBranch() {
@ -687,7 +690,10 @@ async function checkoutLocalBranch(pr: ForgejoPullRequest) {
const branch = pr.head.ref
const { forgejoToken } = getForgejoConfig()
await authedGit(forgejoToken, ["fetch", "origin", "--depth=100", `+${branch}:${branch}`])
await authedGit(forgejoToken, [
"fetch", "origin", "--depth=100",
`+refs/heads/${branch}:refs/remotes/origin/${branch}`,
])
await $`git checkout ${branch}`
}