@@ -1804,22 +1804,30 @@ const TARGET_FILE = core.getInput("TARGET_FILE");
18041804
18051805const capitalize = (str) => str.slice(0, 1).toUpperCase() + str.slice(1);
18061806
1807- const urlPrefix = "https://github.com";
1808-
18091807/**
18101808 * Returns a URL in markdown format for PR's and issues
18111809 * @param {Object | String} item - holds information concerning the issue/PR
18121810 *
18131811 * @returns {String}
18141812 */
1815-
18161813const toUrlFormat = (item) => {
1817- if (typeof item === "object") {
1818- return Object.hasOwnProperty.call(item.payload, "issue")
1819- ? `[#${item.payload.issue.number}](${urlPrefix}/${item.repo.name}/issues/${item.payload.issue.number})`
1820- : `[#${item.payload.pull_request.number}](${urlPrefix}/${item.repo.name}/pull/${item.payload.pull_request.number})`;
1814+ if (typeof item !== "object") {
1815+ return `[${item}](https://github.com/${item})`;
1816+ }
1817+ if (Object.hasOwnProperty.call(item.payload, "comment")) {
1818+ return `[#${item.payload.issue.number}](${item.payload.comment.html_url})`;
1819+ }
1820+ if (Object.hasOwnProperty.call(item.payload, "issue")) {
1821+ return `[#${item.payload.issue.number}](${item.payload.issue.html_url})`;
1822+ }
1823+ if (Object.hasOwnProperty.call(item.payload, "pull_request")) {
1824+ return `[#${item.payload.pull_request.number}](${item.payload.pull_request.html_url})`;
1825+ }
1826+
1827+ if (Object.hasOwnProperty.call(item.payload, "release")) {
1828+ const release = item.payload.release.name || item.payload.release.tag_name;
1829+ return `[${release}](${item.payload.release.html_url})`;
18211830 }
1822- return `[${item}](${urlPrefix}/${item})`;
18231831};
18241832
18251833/**
@@ -1883,9 +1891,7 @@ const serializers = {
18831891 },
18841892 ReleaseEvent: (item) => {
18851893 return `🚀 ${capitalize(item.payload.action)} release ${toUrlFormat(
1886- item.payload.release.name
1887- ? item.payload.release.name
1888- : item.payload.release.tag_name
1894+ item
18891895 )} in ${toUrlFormat(item.repo.name)}`;
18901896 },
18911897};
0 commit comments