diff --git a/dist/index.js b/dist/index.js index 558d038..c815dbb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -19319,6 +19319,10 @@ ${summary}`; body: releaseNotesBody, }); + await core.summary + .addHeading(`Release successful ${version}`) + .addLink("View the release!", release.html_url); + console.log(`on-release: success`); console.log(`post-release: process release ${release.name}`); @@ -19406,6 +19410,9 @@ Release summary console.log( `create_release: Pull request has been created at ${pullRequest.url}` ); + await core.summary + .addHeading(`Created release branch and PR ${version}`) + .addLink("View release PR!", pullRequest.html_url); }; @@ -19437,6 +19444,7 @@ exports.Config = { /***/ 1608: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const core = __nccwpck_require__(2186); const { Constants } = __nccwpck_require__(4438); const { Config, octokit } = __nccwpck_require__(9297); @@ -19463,21 +19471,32 @@ exports.tryMerge = async function tryMerge(headBranch, baseBranch) { base: baseBranch, head: headBranch, }); + core.summary + .addHeading("Back-merge", 2) + .addRaw( + `The ${headBranch} branch was successfully merge into ${baseBranch} branch.` + ); } catch (err) { // could not automatically merge // try creating a PR - await octokit.rest.pulls - .create({ + try { + const { data: pullRequest } = await octokit.rest.pulls.create({ ...Config.repo, base: baseBranch, head: headBranch, title: `Merge ${headBranch} branch into ${baseBranch}`, body: `In Gitflow, \`release\` and \`hotfix\` branches get merged back into \`develop\` branch. See [Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) for more details.`, - }) - .catch(() => { - /** noop */ }); + core.summary + .addHeading("Back-merge", 2) + .addRaw("A PR was created for back-merge, please review ") + .addLink("here", pullRequest.html_url); + } catch (error) { + core.error( + `Couldn't perform back-merge! Merge error: ${err}, PR error ${error}` + ); + } } } else { console.log( @@ -19495,10 +19514,10 @@ exports.isReleaseCandidate = function isReleaseCandidate( shouldLog = false ) { if (pullRequest.base.ref !== Config.prodBranch) { - if (shouldLog) - console.log( - `on-release: ${pullRequest.number} does not merge to main_branch. Exiting...` - ); + const message = `on-release: ${pullRequest.number} does not merge to main_branch. Exiting...`; + if (shouldLog) console.log(message); + + core.summary.addHeading("Not release candidate", 2).addRaw(message); return false; } @@ -19509,10 +19528,10 @@ exports.isReleaseCandidate = function isReleaseCandidate( if (pullRequest.labels.some((label) => label.name === Constants.Hotfix)) return "hotfix"; - if (shouldLog) - console.log( - `on-release: pull request does not have either ${Constants.Release} or ${Constants.Hotfix} labels. Exiting...` - ); + const message = `on-release: pull request does not have either ${Constants.Release} or ${Constants.Hotfix} labels. Exiting...`; + if (shouldLog) console.log(message); + + core.summary.addHeading("Not release candidate", 2).addRaw(message); return false; }; @@ -19754,13 +19773,14 @@ const start = async () => { await createReleasePR(); return; } - console.log( - `gitflow-workflow-action: does not match any eventName. Skipping...` - ); + const message = `gitflow-workflow-action: does not match any eventName. Skipping...`; + console.log(message); + core.summary.addHeading(message, 3); }; start() - .then(() => { + .then(async () => { + await core.summary.write(); process.exitCode = 0; }) .catch((err) => { diff --git a/src/index.js b/src/index.js index f69077f..a00e95a 100644 --- a/src/index.js +++ b/src/index.js @@ -24,13 +24,14 @@ const start = async () => { await createReleasePR(); return; } - console.log( - `gitflow-workflow-action: does not match any eventName. Skipping...` - ); + const message = `gitflow-workflow-action: does not match any eventName. Skipping...`; + console.log(message); + core.summary.addHeading(message, 3); }; start() - .then(() => { + .then(async () => { + await core.summary.write(); process.exitCode = 0; }) .catch((err) => { diff --git a/src/post-release.js b/src/post-release.js index 664640c..d5d8c88 100644 --- a/src/post-release.js +++ b/src/post-release.js @@ -98,6 +98,10 @@ ${summary}`; body: releaseNotesBody, }); + await core.summary + .addHeading(`Release successful ${version}`) + .addLink("View the release!", release.html_url); + console.log(`on-release: success`); console.log(`post-release: process release ${release.name}`); diff --git a/src/release.js b/src/release.js index 659089d..5613f1f 100644 --- a/src/release.js +++ b/src/release.js @@ -65,4 +65,7 @@ Release summary console.log( `create_release: Pull request has been created at ${pullRequest.url}` ); + await core.summary + .addHeading(`Created release branch and PR ${version}`) + .addLink("View release PR!", pullRequest.html_url); }; diff --git a/src/utils.js b/src/utils.js index 9557895..474c6ad 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,3 +1,4 @@ +const core = require("@actions/core"); const { Constants } = require("./constants"); const { Config, octokit } = require("./shared"); @@ -24,21 +25,32 @@ exports.tryMerge = async function tryMerge(headBranch, baseBranch) { base: baseBranch, head: headBranch, }); + core.summary + .addHeading("Back-merge", 2) + .addRaw( + `The ${headBranch} branch was successfully merge into ${baseBranch} branch.` + ); } catch (err) { // could not automatically merge // try creating a PR - await octokit.rest.pulls - .create({ + try { + const { data: pullRequest } = await octokit.rest.pulls.create({ ...Config.repo, base: baseBranch, head: headBranch, title: `Merge ${headBranch} branch into ${baseBranch}`, body: `In Gitflow, \`release\` and \`hotfix\` branches get merged back into \`develop\` branch. See [Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) for more details.`, - }) - .catch(() => { - /** noop */ }); + core.summary + .addHeading("Back-merge", 2) + .addRaw("A PR was created for back-merge, please review ") + .addLink("here", pullRequest.html_url); + } catch (error) { + core.error( + `Couldn't perform back-merge! Merge error: ${err}, PR error ${error}` + ); + } } } else { console.log( @@ -56,10 +68,10 @@ exports.isReleaseCandidate = function isReleaseCandidate( shouldLog = false ) { if (pullRequest.base.ref !== Config.prodBranch) { - if (shouldLog) - console.log( - `on-release: ${pullRequest.number} does not merge to main_branch. Exiting...` - ); + const message = `on-release: ${pullRequest.number} does not merge to main_branch. Exiting...`; + if (shouldLog) console.log(message); + + core.summary.addHeading("Not release candidate", 2).addRaw(message); return false; } @@ -70,9 +82,9 @@ exports.isReleaseCandidate = function isReleaseCandidate( if (pullRequest.labels.some((label) => label.name === Constants.Hotfix)) return "hotfix"; - if (shouldLog) - console.log( - `on-release: pull request does not have either ${Constants.Release} or ${Constants.Hotfix} labels. Exiting...` - ); + const message = `on-release: pull request does not have either ${Constants.Release} or ${Constants.Hotfix} labels. Exiting...`; + if (shouldLog) console.log(message); + + core.summary.addHeading("Not release candidate", 2).addRaw(message); return false; };