Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
agerauer committed Dec 5, 2023
1 parent 22da207 commit 65c1212
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 16 deletions.
31 changes: 23 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24930,14 +24930,29 @@ var mergeBranches = async function(octokit, pulls, tempBranch) {
repo: import_github2.context.repo.repo,
branch: tempBranch
});
console.log(`Updating branch ${integrationBranchName} from ${tempBranch} with commit sha: ${tempSha}.`);
await octokit.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}", {
owner: import_github2.context.repo.owner,
repo: import_github2.context.repo.repo,
ref: `heads/${integrationBranchName}`,
sha: tempSha,
force: true
});
try {
const { data: integrationBranchData } = await octokit.request("GET /repos/{owner}/{repo}/branches/{integrationBranch}", {
owner: import_github2.context.repo.owner,
repo: import_github2.context.repo.repo,
branch: tempBranch
});
console.log(`Creating branch ${integrationBranchName} from ${tempBranch} with commit sha: ${tempSha}.`);
await octokit.request("POST /repos/{owner}/{repo}/git/refs/{ref}", {
owner: import_github2.context.repo.owner,
repo: import_github2.context.repo.repo,
ref: `heads/${integrationBranchName}`,
sha: tempSha
});
} catch (e) {
console.log(`Updating branch ${integrationBranchName} from ${tempBranch} with commit sha: ${tempSha}.`);
await octokit.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}", {
owner: import_github2.context.repo.owner,
repo: import_github2.context.repo.repo,
ref: `heads/${integrationBranchName}`,
sha: tempSha,
force: true
});
}
};

// index.js
Expand Down
31 changes: 23 additions & 8 deletions src/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,27 @@ const mergeBranches = async function (octokit, pulls, tempBranch) {
repo: context.repo.repo,
branch: tempBranch
});
console.log(`Updating branch ${integrationBranchName} from ${tempBranch} with commit sha: ${tempSha}.`);
await octokit.request('PATCH /repos/{owner}/{repo}/git/refs/{ref}', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${integrationBranchName}`,
sha: tempSha,
force: true,
});
try {
const { data: integrationBranchData } = await octokit.request('GET /repos/{owner}/{repo}/branches/{integrationBranch}', {
owner: context.repo.owner,
repo: context.repo.repo,
branch: tempBranch
});
console.log(`Creating branch ${integrationBranchName} from ${tempBranch} with commit sha: ${tempSha}.`);
await octokit.request('POST /repos/{owner}/{repo}/git/refs/{ref}', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${integrationBranchName}`,
sha: tempSha
});
} catch(e) {
console.log(`Updating branch ${integrationBranchName} from ${tempBranch} with commit sha: ${tempSha}.`);
await octokit.request('PATCH /repos/{owner}/{repo}/git/refs/{ref}', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${integrationBranchName}`,
sha: tempSha,
force: true,
});
}
};

0 comments on commit 65c1212

Please sign in to comment.