Skip to content

Commit 3ffccac

Browse files
build: update distribution (#4526)
Co-authored-by: peter-evans <18365890+peter-evans@users.noreply.github.com>
1 parent 77d5650 commit 3ffccac

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎dist/index.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,8 +1644,10 @@ class GitHubHelper {
16441644
createOrUpdateRef(branchRepository, branch, newHead) {
16451645
return __awaiter(this, void 0, void 0, function* () {
16461646
const repository = this.parseRepository(branchRepository);
1647-
const branchExists = yield this.octokit.rest.repos
1648-
.getBranch(Object.assign(Object.assign({}, repository), { branch: branch }))
1647+
// Check the git ref directly rather than using the branches API, which
1648+
// follows branch rename redirects and can return a different branch.
1649+
const branchExists = yield this.octokit.rest.git
1650+
.getRef(Object.assign(Object.assign({}, repository), { ref: `heads/${branch}` }))
16491651
.then(() => true, () => false);
16501652
if (branchExists) {
16511653
core.info(`Branch ${branch} exists; Updating ref`);

0 commit comments

Comments
 (0)