forked from shiptest-ss13/Shiptest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
port tgui changelog (shiptest-ss13#1425)
- Loading branch information
Showing
11 changed files
with
442 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,55 +2,51 @@ name: Compile changelogs | |
|
||
on: | ||
schedule: | ||
- cron: "0 * * * *" | ||
workflow_dispatch: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
compile: | ||
name: "Compile changelogs" | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: "Check for CHANGELOG_ENABLER secret and pass true to output if it exists to be checked by later steps" | ||
- name: "Check for ACTION_ENABLER secret and pass true to output if it exists to be checked by later steps" | ||
id: value_holder | ||
env: | ||
CHANGELOG_ENABLER: ${{ secrets.CHANGELOG_ENABLER }} | ||
ENABLER_SECRET: ${{ secrets.CHANGELOG_ENABLER }} | ||
run: | | ||
unset SECRET_EXISTS | ||
if [ -n $CHANGELOG_ENABLER ]; then SECRET_EXISTS='true' ; fi | ||
echo ::set-output name=CL_ENABLED::${SECRET_EXISTS} | ||
if [ -n "$ENABLER_SECRET" ]; then SECRET_EXISTS=true ; fi | ||
echo "::set-output name=ACTIONS_ENABLED::$SECRET_EXISTS" | ||
- name: "Setup python" | ||
if: steps.value_holder.outputs.CL_ENABLED | ||
if: steps.value_holder.outputs.ACTIONS_ENABLED | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: "3.9" | ||
python-version: '3.x' | ||
- name: "Install deps" | ||
if: steps.value_holder.outputs.CL_ENABLED | ||
if: steps.value_holder.outputs.ACTIONS_ENABLED | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pyyaml | ||
sudo apt-get install dos2unix | ||
- name: "Checkout" | ||
if: steps.value_holder.outputs.CL_ENABLED | ||
if: steps.value_holder.outputs.ACTIONS_ENABLED | ||
uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 25 | ||
- name: "Compile" | ||
if: steps.value_holder.outputs.CL_ENABLED | ||
if: steps.value_holder.outputs.ACTIONS_ENABLED | ||
run: | | ||
python tools/changelog/ss13_genchangelog.py html/changelog.html html/changelogs | ||
- name: "Convert Lineendings" | ||
if: steps.value_holder.outputs.CL_ENABLED | ||
run: | | ||
unix2dos html/changelogs/.all_changelog.yml | ||
python tools/ss13_genchangelog.py html/changelogs | ||
- name: Commit | ||
if: steps.value_holder.outputs.CL_ENABLED | ||
if: steps.value_holder.outputs.ACTIONS_ENABLED | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Changelogs" | ||
git pull origin master | ||
git add html/changelogs | ||
git commit -m "Automatic changelog compile [ci skip]" -a || true | ||
- name: "Push" | ||
if: steps.value_holder.outputs.CL_ENABLED | ||
if: steps.value_holder.outputs.ACTIONS_ENABLED | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.CHANGELOG_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,3 +205,4 @@ Temporary Items | |
|
||
# tool-generated files | ||
check_regex_output.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
GLOBAL_DATUM(changelog_tgui, /datum/changelog) | ||
|
||
/datum/changelog | ||
var/static/list/changelog_items = list() | ||
|
||
/datum/changelog/ui_state() | ||
return GLOB.always_state | ||
|
||
/datum/changelog/ui_interact(mob/user, datum/tgui/ui) | ||
ui = SStgui.try_update_ui(user, src, ui) | ||
if (!ui) | ||
ui = new(user, src, "Changelog") | ||
ui.open() | ||
|
||
/datum/changelog/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) | ||
. = ..() | ||
if(.) | ||
return | ||
if(action == "get_month") | ||
var/datum/asset/changelog_item/changelog_item = changelog_items[params["date"]] | ||
if (!changelog_item) | ||
changelog_item = new /datum/asset/changelog_item(params["date"]) | ||
changelog_items[params["date"]] = changelog_item | ||
return ui.send_asset(changelog_item) | ||
|
||
/datum/changelog/ui_static_data() | ||
var/list/data = list( "dates" = list() ) | ||
var/regex/ymlRegex = regex(@"\.yml", "g") | ||
|
||
for(var/archive_file in sortList(flist("html/changelogs/archive/"))) | ||
var/archive_date = ymlRegex.Replace(archive_file, "") | ||
data["dates"] = list(archive_date) + data["dates"] | ||
|
||
return data | ||
|
||
/datum/asset/changelog_item | ||
_abstract = /datum/asset/changelog_item | ||
var/item_filename | ||
|
||
/datum/asset/changelog_item/New(date) | ||
item_filename = SANITIZE_FILENAME("[date].yml") | ||
SSassets.transport.register_asset(item_filename, file("html/changelogs/archive/" + item_filename)) | ||
|
||
/datum/asset/changelog_item/send(client) | ||
if (!item_filename) | ||
return | ||
. = SSassets.transport.send_assets(client, item_filename) | ||
|
||
/datum/asset/changelog_item/get_url_mappings() | ||
if (!item_filename) | ||
return | ||
. = list("[item_filename]" = SSassets.transport.get_asset_url(item_filename)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.