mirror of
https://github.com/SethCohen/github-releases-to-discord
synced 2026-09-14 20:13:23 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26399c645d | ||
|
|
07c2e1c3e6 |
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## [1.16.0](https://github.com/SethCohen/github-releases-to-discord/compare/v1.15.3...v1.16.0) (2024-10-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add function to convert PR, issue, and changelog links to markdown format ([07c2e1c](https://github.com/SethCohen/github-releases-to-discord/commit/07c2e1c3e60591d601b5d4b5bd4fc90e599867f8)), closes [#32](https://github.com/SethCohen/github-releases-to-discord/issues/32)
|
||||
|
||||
## [1.15.3](https://github.com/SethCohen/github-releases-to-discord/compare/v1.15.2...v1.15.3) (2024-10-18)
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,36 @@ const reduceHeadings = (text) => text
|
||||
.replace(/^###\s+(.+)$/gm, '**__$1__**') // Convert H3 to bold + underline
|
||||
.replace(/^##\s+(.+)$/gm, '**$1**'); // Convert H2 to bold
|
||||
|
||||
/**
|
||||
* Converts PR links, issue links, and changelog links to markdown format.
|
||||
* - PR links: `https://github.com/OWNER/REPO/pull/1` -> `[PR #1](https://github.com/OWNER/REPO/pull/1)`
|
||||
* - Issue links: `https://github.com/OWNER/REPO/issues/1` -> `[Issue #30](https://github.com/OWNER/REPO/issues/1)`
|
||||
* - Changelog links: `https://github.com/OWNER/REPO/compare/v1.0.0...v1.1.0` -> `[v1.0.0...v1.1.0](https://github.com/OWNER/REPO/compare/v1.0.0...v1.1.0)`
|
||||
* @param {string} text The input text.
|
||||
* @returns {string} The text with links converted to markdown format.
|
||||
*/
|
||||
const convertLinksToMarkdown = (text) => {
|
||||
// Convert PR links
|
||||
text = text.replace(
|
||||
/https:\/\/github\.com\/([\w-]+)\/([\w-]+)\/pull\/(\d+)/g,
|
||||
(match, owner, repo, prNumber) => `[PR #${prNumber}](${match})`
|
||||
);
|
||||
|
||||
// Convert issue links
|
||||
text = text.replace(
|
||||
/https:\/\/github\.com\/([\w-]+)\/([\w-]+)\/issues\/(\d+)/g,
|
||||
(match, owner, repo, issueNumber) => `[Issue #${issueNumber}](${match})`
|
||||
);
|
||||
|
||||
// Convert changelog comparison links
|
||||
text = text.replace(
|
||||
/https:\/\/github\.com\/([\w-]+)\/([\w-]+)\/compare\/([v\w.-]+)\.\.\.([v\w.-]+)/g,
|
||||
(match, owner, repo, fromVersion, toVersion) => `[${fromVersion}...${toVersion}](${match})`
|
||||
);
|
||||
|
||||
return text;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stylizes a markdown body into an appropriate embed message style.
|
||||
* @param {string} description The description to format.
|
||||
@@ -57,6 +87,7 @@ const formatDescription = (description) => {
|
||||
edit = removeHTMLComments(edit);
|
||||
edit = reduceNewlines(edit);
|
||||
edit = convertMentionsToLinks(edit);
|
||||
edit = convertLinksToMarkdown(edit);
|
||||
edit = edit.trim();
|
||||
|
||||
if (core.getBooleanInput('reduce_headings')) {
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "github-releases-to-discord",
|
||||
"version": "1.15.3",
|
||||
"version": "1.16.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "github-releases-to-discord",
|
||||
"version": "1.15.3",
|
||||
"version": "1.16.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "github-releases-to-discord",
|
||||
"version": "1.15.3",
|
||||
"version": "1.16.0",
|
||||
"description": "A GitHub Action that automatically sends a stylized Discord webhook of a GitHub Release description to a specified Discord channel.",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
|
||||
Reference in New Issue
Block a user