From 242b278cf458c1cc60e2da66406da8b9584bef2f Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 24 Apr 2022 23:58:43 +0300 Subject: [PATCH 1/4] update pr creation process --- src/actions.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/actions.js b/src/actions.js index 8bbdda6..450f460 100644 --- a/src/actions.js +++ b/src/actions.js @@ -9,7 +9,6 @@ const octokit = github.getOctokit(GITHUB_TOKEN); const { context = {} } = github; const run = async () => { - console.log(context.payload); // check branch; const branch_name = context.payload?.head_commit?.message ?.split("from")[1] From a8f43b2143ce65b3026e96ecbb5ed0d47c8331ef Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 24 Apr 2022 23:58:59 +0300 Subject: [PATCH 2/4] update pr creation process --- action/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/action/index.js b/action/index.js index f626f84..460e16b 100644 --- a/action/index.js +++ b/action/index.js @@ -12406,7 +12406,6 @@ const octokit = github.getOctokit(GITHUB_TOKEN); const { context = {} } = github; const run = async () => { - console.log(context.payload); // check branch; const branch_name = context.payload?.head_commit?.message ?.split("from")[1] From e1a8af4d9a236b63cd19a114b379407f35ddd636 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 25 Apr 2022 00:02:28 +0300 Subject: [PATCH 3/4] add default branch on failure --- src/actions.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/actions.js b/src/actions.js index 450f460..d85c1ad 100644 --- a/src/actions.js +++ b/src/actions.js @@ -10,14 +10,16 @@ const { context = {} } = github; const run = async () => { // check branch; - const branch_name = context.payload?.head_commit?.message + let branch_name = context.payload?.head_commit?.message ?.split("from")[1] - .split("\n")[0] + ?.split("\n")[0] ?.split("/") ?.slice(1) ?.join("/"); - console.log(branch_name); + if (branch_name === "" || branch_name === undefined || branch_name === null) { + branch_name = context.payload.ref?.replace("refs/heads/", ""); + } // fetching commits let commits = ""; From 2168498aee9cb8ba034b49ff93d22e1f49ad22b0 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 25 Apr 2022 00:02:46 +0300 Subject: [PATCH 4/4] update pr creation process --- action/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/action/index.js b/action/index.js index 460e16b..10f5931 100644 --- a/action/index.js +++ b/action/index.js @@ -12407,14 +12407,16 @@ const { context = {} } = github; const run = async () => { // check branch; - const branch_name = context.payload?.head_commit?.message + let branch_name = context.payload?.head_commit?.message ?.split("from")[1] - .split("\n")[0] + ?.split("\n")[0] ?.split("/") ?.slice(1) ?.join("/"); - console.log(branch_name); + if (branch_name === "" || branch_name === undefined || branch_name === null) { + branch_name = context.payload.ref?.replace("refs/heads/", ""); + } // fetching commits let commits = "";