Compare commits

..
Author SHA1 Message Date
copilot-swe-agent[bot]andCopilot c9d6e44db2 fix: check git ref directly when pushing signed commits
The branches API follows branch rename redirects, so a branch name that was
previously renamed resolves to the renamed branch. This caused the ref to be
reported as existing, and the subsequent updateRef failed with 'Reference does
not exist'. Check the git ref directly instead, which is the same ref that is
then created or updated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-10 11:40:59 +00:00
+2 -4
View File
@@ -1644,10 +1644,8 @@ class GitHubHelper {
createOrUpdateRef(branchRepository, branch, newHead) {
return __awaiter(this, void 0, void 0, function* () {
const repository = this.parseRepository(branchRepository);
// Check the git ref directly rather than using the branches API, which
// follows branch rename redirects and can return a different branch.
const branchExists = yield this.octokit.rest.git
.getRef(Object.assign(Object.assign({}, repository), { ref: `heads/${branch}` }))
const branchExists = yield this.octokit.rest.repos
.getBranch(Object.assign(Object.assign({}, repository), { branch: branch }))
.then(() => true, () => false);
if (branchExists) {
core.info(`Branch ${branch} exists; Updating ref`);