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 652b0f9 commit 0180f98
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
10 changes: 6 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24867,10 +24867,10 @@ var groupLabeledPullRequests = async function(octokit) {
const tempBranch = `temp-ci-${import_github2.context.repo.repo}-${Date.now()}`;
try {
var pulls = [];
var comment = "### Going to merge pull requests:\n";
var prLinks = "";
const label = (0, import_core.getInput)("target-label");
const q = `is:pull-request label:${label} repo:${import_github2.context.repo.owner}/${import_github2.context.repo.repo} state:open`;
console.log("QUERY " + q);
const { data } = await octokit.search.issuesAndPullRequests({
q,
sort: "created",
Expand All @@ -24888,10 +24888,12 @@ var groupLabeledPullRequests = async function(octokit) {
`;
pulls.push(accPull.data);
}
await mergeBranches(octokit, pulls, tempBranch);
await cleanup(octokit, tempBranch);
(0, import_core.setOutput)("temp-branch", tempBranch);
} else {
console.log("No open pull requests found");
}
await mergeBranches(octokit, pulls, tempBranch);
await cleanup(octokit, tempBranch);
(0, import_core.setOutput)("temp-branch", tempBranch);
} catch (e) {
if (e.message === "Merge conflict") {
console.log("Merge conflict error.");
Expand Down
16 changes: 10 additions & 6 deletions src/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export const groupLabeledPullRequests = async function (octokit) {
try {
//get input from Github Job declaration
var pulls = [];
var comment = '### Going to merge pull requests:\n';
var prLinks = '';
const label = getInput('target-label');
//Create search query
const q = `is:pull-request label:${label} repo:${context.repo.owner}/${context.repo.repo} state:open`;
console.log("QUERY " + q)
//Call github API through the octokit client
const { data } = await octokit.search.issuesAndPullRequests({
q,
Expand All @@ -36,13 +36,17 @@ export const groupLabeledPullRequests = async function (octokit) {
prLinks += `- ${item.html_url}\n`;
pulls.push(accPull.data);
}
}
await mergeBranches(octokit, pulls, tempBranch);

await mergeBranches(octokit, pulls, tempBranch);
//cleanup function (delete temp branch)
await cleanup(octokit, tempBranch);
setOutput('temp-branch', tempBranch);

} else {
console.log("No open pull requests found")
}

//cleanup function (delete temp branch)
await cleanup(octokit, tempBranch);
setOutput('temp-branch', tempBranch);

} catch (e) {
if (e.message === "Merge conflict") {
console.log("Merge conflict error.")
Expand Down

0 comments on commit 0180f98

Please sign in to comment.