From 0180f98ea777e1a9fa19db69916312e7c275300d Mon Sep 17 00:00:00 2001 From: Andreas Gerauer Date: Tue, 5 Dec 2023 16:42:19 +0100 Subject: [PATCH] build --- dist/index.js | 10 ++++++---- src/merge.js | 16 ++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 0716ae5..a26a31f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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", @@ -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."); diff --git a/src/merge.js b/src/merge.js index b61beed..c0618ec 100644 --- a/src/merge.js +++ b/src/merge.js @@ -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, @@ -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.")