Skip to content
54 changes: 37 additions & 17 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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);
};


Expand Down Expand Up @@ -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);

Expand All @@ -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(
Expand All @@ -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;
}

Expand All @@ -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;
};

Expand Down Expand Up @@ -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) => {
Expand Down
9 changes: 5 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
4 changes: 4 additions & 0 deletions src/post-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
3 changes: 3 additions & 0 deletions src/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
38 changes: 25 additions & 13 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const core = require("@actions/core");
const { Constants } = require("./constants");
const { Config, octokit } = require("./shared");

Expand All @@ -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(
Expand All @@ -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;
}

Expand All @@ -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;
};