diff --git a/action/index.js b/action/index.js index f626f84..10f5931 100644 --- a/action/index.js +++ b/action/index.js @@ -12406,16 +12406,17 @@ 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 + 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 = ""; diff --git a/src/actions.js b/src/actions.js index 8bbdda6..d85c1ad 100644 --- a/src/actions.js +++ b/src/actions.js @@ -9,16 +9,17 @@ 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 + 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 = "";