feat: add manual dispatch support for GitHub Actions to test Discord webhook integration with optional release inputs. resolves #52

This commit is contained in:
SethCohen
2026-04-03 12:42:38 -04:00
parent 80aca15d72
commit e15eb81a91
5 changed files with 224 additions and 25 deletions
+30 -1
View File
@@ -7,7 +7,8 @@ import {
reduceHeadings,
convertLinksToMarkdown,
limitString,
formatDescription
formatDescription,
resolveReleaseContext
} from '../index.js';
import { jest } from '@jest/globals';
@@ -94,6 +95,34 @@ describe('index.js utility functions', () => {
expect(convertLinksToMarkdown(input)).toBe('[already](https://github.com/owner/repo/pull/1) and [PR #2](https://github.com/owner/repo/pull/2)');
});
describe('resolveReleaseContext', () => {
test('uses release payload when present', () => {
const release = {
name: 'v1.2.3',
body: 'Release notes',
html_url: 'https://example.com/releases/v1.2.3'
};
expect(resolveReleaseContext(release, {
name: 'ignored',
body: 'ignored',
html_url: 'https://example.com/ignored'
})).toEqual(release);
});
test('falls back to manual inputs when release payload is missing', () => {
expect(resolveReleaseContext(null, {
name: 'manual release',
body: 'manual body',
html_url: 'https://example.com/manual'
})).toEqual({
name: 'manual release',
body: 'manual body',
html_url: 'https://example.com/manual'
});
});
});
describe('limitString', () => {
test('returns string unchanged if under maxLength', () => {
expect(limitString('short', 10)).toBe('short');