mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 12:01:47 +00:00
I wanted to move auto labeling into its own workflow, but realized that it and changelog generation were coupled. So I'm detaching that first, and then will work on auto labeling later. Includes general code for a changelog parser so that I can reuse it by that point. GitHub actions are great for downstreams, as setting up a PHP server for the webhook is not trivial, compared to Existing and getting it for free. They are also much more straightforward to test and update than the webhook. I was able to verify this was working trivially with an empty repository. Tested and working: Mothblocks/ss13-workflow-testing@0a2de4d
73 lines
1.6 KiB
JavaScript
73 lines
1.6 KiB
JavaScript
import { strict as assert } from "node:assert";
|
|
import { parseChangelog } from "./changelogParser.js";
|
|
|
|
// Basic test
|
|
const basicChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl: DenverCoder9
|
|
add: Adds new stuff
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(basicChangelog.author, "DenverCoder9");
|
|
assert.equal(basicChangelog.changes.length, 1);
|
|
assert.equal(basicChangelog.changes[0].type.changelogKey, "rscadd");
|
|
assert.equal(basicChangelog.changes[0].description, "Adds new stuff");
|
|
|
|
// Multi-line test
|
|
const multiLineChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl:
|
|
add: Adds new stuff
|
|
to the game
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(multiLineChangelog.author, undefined);
|
|
assert.equal(multiLineChangelog.changes.length, 1);
|
|
assert.equal(multiLineChangelog.changes[0].type.changelogKey, "rscadd");
|
|
assert.equal(
|
|
multiLineChangelog.changes[0].description,
|
|
"Adds new stuff\nto the game"
|
|
);
|
|
|
|
// Placeholders
|
|
const placeholderChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl:
|
|
add: Added new mechanics or gameplay changes
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(placeholderChangelog.changes.length, 0);
|
|
|
|
// No changelog
|
|
const noChangelog = parseChangelog(`
|
|
My cool PR!
|
|
`);
|
|
|
|
assert.equal(noChangelog, undefined);
|
|
|
|
// No /:cl:
|
|
|
|
const noCloseChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl:
|
|
add: Adds new stuff
|
|
`);
|
|
|
|
assert.equal(noCloseChangelog.changes.length, 1);
|
|
assert.equal(noCloseChangelog.changes[0].type.changelogKey, "rscadd");
|
|
assert.equal(noCloseChangelog.changes[0].description, "Adds new stuff");
|
|
|
|
// :cl: with arbitrary text
|
|
|
|
const arbitraryTextChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl:
|
|
Adds new stuff
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(arbitraryTextChangelog.changes.length, 0);
|