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 9898979 commit e365307
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 2 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24867,7 +24867,6 @@ var groupLabeledPullRequests = async function(octokit) {
const tempBranch = `temp-ci-${import_github2.context.repo.repo}-${Date.now()}`;
try {
var pulls = [];
var prLinks = "";
const label = (0, import_core.getInput)("target-label");
const q = `is:pr label:${label} repo:${import_github2.context.repo.owner}/${import_github2.context.repo.repo} state:open`;
console.log("QUERY " + q);
Expand All @@ -24884,8 +24883,6 @@ var groupLabeledPullRequests = async function(octokit) {
pull_number: item.number
});
console.log(`Pushing External PR #${item.number} to array`);
prLinks += `- ${item.html_url}
`;
pulls.push(accPull.data);
}
await mergeBranches(octokit, pulls, tempBranch);
Expand All @@ -24895,6 +24892,7 @@ var groupLabeledPullRequests = async function(octokit) {
console.log("No open pull requests found");
}
} catch (e) {
console.error(e);
if (e.message === "Merge conflict") {
console.log("Merge conflict error.");
}
Expand All @@ -24903,8 +24901,6 @@ var groupLabeledPullRequests = async function(octokit) {
}
};
var mergeBranches = async function(octokit, pulls, tempBranch) {
const token = (0, import_core.getInput)("private-token");
const octokitMerge = (0, import_github2.getOctokit)(token);
const mainBranchName = (0, import_core.getInput)("main-branch");
const integrationBranchName = (0, import_core.getInput)("integration-branch");
const { data: { commit: { sha } } } = await octokit.request("GET /repos/{owner}/{repo}/branches/{branch}", {
Expand Down Expand Up @@ -24935,7 +24931,7 @@ var mergeBranches = async function(octokit, pulls, tempBranch) {
branch: tempBranch
});
console.log(`Updating branch ${integrationBranchName} from ${tempBranch} with commit sha: ${tempSha}.`);
await octokitMerge.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}", {
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}`,
Expand Down
9 changes: 4 additions & 5 deletions src/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const groupLabeledPullRequests = async function (octokit) {
try {
//get input from Github Job declaration
var pulls = [];
var prLinks = '';
const label = getInput('target-label');
//Create search query
const q = `is:pr label:${label} repo:${context.repo.owner}/${context.repo.repo} state:open`;
Expand All @@ -33,7 +32,6 @@ export const groupLabeledPullRequests = async function (octokit) {
pull_number: item.number
});
console.log(`Pushing External PR #${item.number} to array`);
prLinks += `- ${item.html_url}\n`;
pulls.push(accPull.data);
}
await mergeBranches(octokit, pulls, tempBranch);
Expand All @@ -48,6 +46,7 @@ export const groupLabeledPullRequests = async function (octokit) {


} catch (e) {
console.error(e)
if (e.message === "Merge conflict") {
console.log("Merge conflict error.")
//Add label
Expand All @@ -66,8 +65,8 @@ export const groupLabeledPullRequests = async function (octokit) {
*/
const mergeBranches = async function (octokit, pulls, tempBranch) {
//get client with permissions to merge
const token = getInput('private-token');
const octokitMerge = getOctokit(token);
// const token = getInput('private-token');
// const octokitMerge = getOctokit(token);
//get latest main branch sha.
const mainBranchName = getInput('main-branch');
const integrationBranchName = getInput('integration-branch');
Expand Down Expand Up @@ -102,7 +101,7 @@ const mergeBranches = async function (octokit, pulls, tempBranch) {
branch: tempBranch
});
console.log(`Updating branch ${integrationBranchName} from ${tempBranch} with commit sha: ${tempSha}.`);
await octokitMerge.request('PATCH /repos/{owner}/{repo}/git/refs/{ref}', {
await octokit.request('PATCH /repos/{owner}/{repo}/git/refs/{ref}', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${integrationBranchName}`,
Expand Down

0 comments on commit e365307

Please sign in to comment.