From 11f542ad4238e77179bdf0fb5ba213e208900a9e Mon Sep 17 00:00:00 2001 From: Benedict Steven Date: Mon, 25 Apr 2022 18:54:58 +0000 Subject: [PATCH 1/6] Skip CI --- action/index.js | 1 - changelog.md | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/action/index.js b/action/index.js index 9850da2..ee73bb6 100644 --- a/action/index.js +++ b/action/index.js @@ -12497,7 +12497,6 @@ const run = async () => { } catch (error) { console.log("error", error?.message); } - // update PR try { const options = { diff --git a/changelog.md b/changelog.md index c9c3580..dc2a9f1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,6 @@ # 1.0.1 +* new test +# 1.0.1 * fix typo # 1.0.1 * test bump version From 5b04b364c9a7586184319757f73d7be9ca7d061a Mon Sep 17 00:00:00 2001 From: Benedict Steven Date: Mon, 25 Apr 2022 19:06:17 +0000 Subject: [PATCH 2/6] Skip CI --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index dc2a9f1..7bb28db 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,8 @@ # 1.0.1 +* test manually update version + +* reset bump version actions +# 1.0.1 * new test # 1.0.1 * fix typo From 475b080e0f760cdf15af258e018bb153967dc00f Mon Sep 17 00:00:00 2001 From: Benedict Steven Date: Mon, 25 Apr 2022 21:03:07 +0000 Subject: [PATCH 3/6] Skip CI --- changelog.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 7bb28db..0e5c8d9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,5 @@ +# 1.0.2 +* test bump version actions # 1.0.1 * test manually update version diff --git a/package.json b/package.json index af26f51..d367312 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "automate-pull-request", - "version": "1.0.1", + "version": "1.0.2", "description": "", "main": "index.js", "scripts": { From 7460669173b454c4b2bbb9935de5b05961d906fc Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 26 Apr 2022 00:18:10 +0300 Subject: [PATCH 4/6] Add extra condition for when there is no commits or commit = skip ci --- src/actions.js | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/actions.js b/src/actions.js index d77c653..6afc18d 100644 --- a/src/actions.js +++ b/src/actions.js @@ -56,6 +56,8 @@ const run = async () => { console.log(error?.message); } + console.log(commits); + // attempt to create PR try { let options = { @@ -79,23 +81,27 @@ const run = async () => { }, ], }; - const createpr = await createorupdatepr({ - branch: branch_name, - body: commits, - owner: context.payload?.repository?.owner?.login, - repo: context.payload?.repository?.name, - full_name: context.payload?.repository?.full_name, - }); - if (createpr?.data) { - axios - .post(SLACK_WEBHOOK_URL, JSON.stringify(options)) - .then((response) => { - console.log("SUCCEEDED: Sent slack webhook", response.data); - }) - .catch((error) => { - console.log("FAILED: Send slack webhook", error); - }); - return; + if (commits != "") { + const createpr = await createorupdatepr({ + branch: branch_name, + body: commits, + owner: context.payload?.repository?.owner?.login, + repo: context.payload?.repository?.name, + full_name: context.payload?.repository?.full_name, + }); + if (createpr?.data) { + axios + .post(SLACK_WEBHOOK_URL, JSON.stringify(options)) + .then((response) => { + console.log("SUCCEEDED: Sent slack webhook", response.data); + }) + .catch((error) => { + console.log("FAILED: Send slack webhook", error); + }); + return; + } + } else { + console.log("No commits to create this PR"); } } catch (error) { console.log("error", error?.message); From a78b387fe56ee4cc1247f88252378c9c1917cdb3 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 26 Apr 2022 00:19:28 +0300 Subject: [PATCH 5/6] add build file --- action/index.js | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/action/index.js b/action/index.js index 9850da2..2460b26 100644 --- a/action/index.js +++ b/action/index.js @@ -12453,6 +12453,8 @@ const run = async () => { console.log(error?.message); } + console.log(commits); + // attempt to create PR try { let options = { @@ -12476,28 +12478,31 @@ const run = async () => { }, ], }; - const createpr = await createorupdatepr({ - branch: branch_name, - body: commits, - owner: context.payload?.repository?.owner?.login, - repo: context.payload?.repository?.name, - full_name: context.payload?.repository?.full_name, - }); - if (createpr?.data) { - axios - .post(SLACK_WEBHOOK_URL, JSON.stringify(options)) - .then((response) => { - console.log("SUCCEEDED: Sent slack webhook", response.data); - }) - .catch((error) => { - console.log("FAILED: Send slack webhook", error); - }); - return; + if (commits != "") { + const createpr = await createorupdatepr({ + branch: branch_name, + body: commits, + owner: context.payload?.repository?.owner?.login, + repo: context.payload?.repository?.name, + full_name: context.payload?.repository?.full_name, + }); + if (createpr?.data) { + axios + .post(SLACK_WEBHOOK_URL, JSON.stringify(options)) + .then((response) => { + console.log("SUCCEEDED: Sent slack webhook", response.data); + }) + .catch((error) => { + console.log("FAILED: Send slack webhook", error); + }); + return; + } + } else { + console.log("No commits to create this PR"); } } catch (error) { console.log("error", error?.message); } - // update PR try { const options = { From 5686f04ca2ee6a09e188548adc36b713b18ead4a Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 26 Apr 2022 00:30:42 +0300 Subject: [PATCH 6/6] fix getting commits --- action/index.js | 2 -- src/actions.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/action/index.js b/action/index.js index 2460b26..140961c 100644 --- a/action/index.js +++ b/action/index.js @@ -12430,8 +12430,6 @@ const run = async () => { } ); - let commits = ""; - if (compare_commits?.data?.commits?.length === 0) { commits = ""; return; diff --git a/src/actions.js b/src/actions.js index 6afc18d..677bc68 100644 --- a/src/actions.js +++ b/src/actions.js @@ -33,8 +33,6 @@ const run = async () => { } ); - let commits = ""; - if (compare_commits?.data?.commits?.length === 0) { commits = ""; return;