Skip to content

Commit

Permalink
Changelog Generation | BandaStation (#1012)
Browse files Browse the repository at this point in the history
## Что этот PR делает
Изменяет пути к чейнджлогам в системе ТГ. Кастомизирует окно чейнджлога.

По результатам бурного обсуждения в дисе стало ясно, что у системы
чейнджлога есть 2 основные проблемы:
1. Изменение чейнджлога в индексированном архивном файле может приводить
к конфликтам при мерже апстрима.
2. Изменение чейнджлога происходит с созданием дополнительного коммита.

Проблема 1 решается этим ПРом, поскольку чейнджлог лежит в
поддиректории.
Проблема 2 может решиться наличием отдельной ветки и ленивыми HTTP
запросами, но она мне не кажется существенной, особенно с учетом того,
что коммиты ТГ уже переносятся в наш мастер `как-есть` и чейнджлог
коммиты все равно останутся.

## Тестирование


m-dzianishchyts@b15f7eb

m-dzianishchyts@9b6bb0b

<details><summary>Картинко</summary>
<p>


![image](https://github.com/user-attachments/assets/e98a258a-5db6-4fec-8258-22bd96fd0b1e)

</p>
</details>

## Summary by Sourcery

Update changelog paths and customize the changelog window.

New Features:
- Add a new changelog interface for BandaStation.

Build:
- Update changelog compilation path.

CI:
- Update CI workflows to use the new changelog path and always run the
changelog generation job when a PR is merged.

---------

Co-authored-by: Gaxeer <[email protected]>
  • Loading branch information
m-dzianishchyts and Gaxeer authored Jan 18, 2025
1 parent 1367bfb commit 62c8820
Show file tree
Hide file tree
Showing 13 changed files with 429 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
jobs:
auto_changelog:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.head_ref != 'merge-upstream'
if: github.event.pull_request.merged == true
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/compile_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ jobs:
- name: "Compile"
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
python tools/ss13_genchangelog.py html/changelogs
python tools/ss13_genchangelog.py html/changelogs/bandastation
- name: Commit
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
git config --local user.name "tgstation-ci[bot]"
git config --local user.email "179393467+tgstation-ci[bot]@users.noreply.github.com"
git pull origin master
git add html/changelogs
git add html/changelogs/bandastation
git commit -m "Automatic changelog compile [ci skip]" -a || true
- name: Generate App Token
Expand Down
3 changes: 3 additions & 0 deletions html/changelogs/bandastation/archive/2025-01.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
2025-01-18:
AyIong:
- bugfix: Лейтджоин ИИ, больше не будут смотреть на лобби арт и общаться IC
8 changes: 8 additions & 0 deletions modular_bandastation/changelog/_changelog.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/datum/modpack/changelog
name = "Чейнджлог"
desc = "Кастомизация чейнджлога BandaStation."
author = "Maxiemar"

/datum/modpack/changelog/initialize()
var/latest_changelog = file("[global.config.directory]/../html/changelogs/bandastation/archive/" + time2text(world.timeofday, "YYYY-MM") + ".yml")
GLOB.changelog_hash = fexists(latest_changelog) ? md5(latest_changelog) : 0 //for telling if the changelog has changed recently
4 changes: 4 additions & 0 deletions modular_bandastation/changelog/_changelog.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "_changelog.dm"

#include "code/changelog.dm"
#include "code/changelog_item.dm"
15 changes: 15 additions & 0 deletions modular_bandastation/changelog/code/changelog.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/datum/changelog/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "ChangelogBandaStation")
ui.open()

/datum/changelog/ui_static_data()
var/list/data = list("dates" = list())
var/static/regex/yml_regex = regex(@"\.yml", "g")

for(var/archive_file in sort_list(flist("html/changelogs/bandastation/archive/")))
var/archive_date = yml_regex.Replace(archive_file, "")
data["dates"] = list(archive_date) + data["dates"]

return data
3 changes: 3 additions & 0 deletions modular_bandastation/changelog/code/changelog_item.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/asset/changelog_item/New(date)
item_filename = SANITIZE_FILENAME("[date].yml")
SSassets.transport.register_asset(item_filename, file("html/changelogs/bandastation/archive/" + item_filename))
1 change: 1 addition & 0 deletions modular_bandastation/modular_bandastation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "autohiss/_autohiss.dme"
#include "balance/_balance.dme"
#include "barsigns/_barsigns.dme"
#include "changelog/_changelog.dme"
#include "chat_badges/_chat_badges.dme"
#include "communication/_communication.dme"
#include "customization/_customization.dme"
Expand Down
Loading

0 comments on commit 62c8820

Please sign in to comment.