Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show testmerge changelogs, refactor into TypeScript #1923

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions monkestation/code/datums/changelog/changelog.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/datum/changelog/ui_static_data()
. = ..()
for(var/datum/tgs_revision_information/test_merge/testmerge in world.TgsTestMerges())
if(!testmerge.body || findtext(testmerge.title, @"[s]"))
continue
var/list/changes = parse_github_changelog(testmerge.body)
if(!length(changes))
changes = list("unknown" = list("Changes are not documented. Ask the author ([testmerge.author]) to add a changelog to their PR!"))
var/list/testmerge_data = list(
"title" = "[testmerge.title]",
"number" = testmerge.number,
"author" = testmerge.author,
"link" = testmerge.url,
"changes" = changes,
)
LAZYADD(.["testmerges"], list(testmerge_data))

/proc/parse_github_changelog(body) as /list
var/static/regex/cl_pattern = new(@"(:cl:|🆑)([\S \t]*)$")
var/static/regex/entry_pattern = new(@"(\w+): (.+)")
var/static/regex/end_pattern = new(@"^/(:cl:|🆑)")
var/static/regex/newline_pattern = new(@"(\r\n|\r|\n)")

var/started = FALSE
var/list/lines = splittext_char(trimtext(body), newline_pattern)

for (var/line in lines)
line = trimtext(line)
if(findtext_char(line, end_pattern))
break
if(started)
if (findtext_char(line, entry_pattern))
var/change_type = trimtext(entry_pattern.group[1])
var/change_desc = trimtext(entry_pattern.group[2])
if(!change_type || !change_desc)
continue
LAZYADDASSOCLIST(., change_type, change_desc)
else
if(findtext_char(line, cl_pattern))
started = TRUE
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -5715,6 +5715,7 @@
#include "monkestation\code\datums\announcers\duke.dm"
#include "monkestation\code\datums\brain_damage\magic.dm"
#include "monkestation\code\datums\brain_damage\phobia.dm"
#include "monkestation\code\datums\changelog\changelog.dm"
#include "monkestation\code\datums\components\carbon_sprint.dm"
#include "monkestation\code\datums\components\crafting.dm"
#include "monkestation\code\datums\components\irradiated.dm"
Expand Down
346 changes: 0 additions & 346 deletions tgui/packages/tgui/interfaces/Changelog.js

This file was deleted.

Loading
Loading