Skip to content

Commit

Permalink
Merge branch 'space-sunrise:master' into medibot
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinary1 authored Jun 12, 2024
2 parents 7ad4808 + f7137f9 commit 76ee898
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 15 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/update_changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update changelog

on:
push:
branches: [master]
pull_request:
types: [closed]
branches: [master]

jobs:
update_changelog:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Extract Changelog from PR
run: python3 Tools/update_changelog.py "${{ github.event.pull_request.body }}" "Resources/Changelog/ChangelogSunrise.yml"

- name: Commit and Push Changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add CHANGELOG.yml
git commit -m 'Update changelog from PR #${{ github.event.pull_request.number }}'
git push
2 changes: 1 addition & 1 deletion Content.Client/Materials/UI/MaterialStorageControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ protected override void FrameUpdate(FrameEventArgs args)
}

_currentMaterials = mats;
NoMatsLabel.Visible = ChildCount == 1;
NoMatsLabel.Visible = MaterialList.ChildCount == 1;
}
}
14 changes: 7 additions & 7 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
Entries:
- author: Killerqu00
changes:
- message: Cable Coils are now small in size, taking only 1x2 space in containers.
type: Tweak
id: 6213
time: '2024-03-23T17:30:14.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/26361
- author: Tayrtahn
changes:
- message: Clumsy characters can no longer avoid bonking their heads by using the
Expand Down Expand Up @@ -3851,3 +3844,10 @@
id: 6712
time: '2024-06-12T01:07:37.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/28854
- author: Deserty0
changes:
- message: '"no materials loaded" messege now appears in lathes!'
type: Fix
id: 6713
time: '2024-06-12T10:32:11.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/28885
6 changes: 3 additions & 3 deletions Resources/Prototypes/Entities/Clothing/Head/soft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- state: icon_flipped
map: ["foldedLayer"]
visible: false

- type: entity
parent: ClothingHeadHeadHatBaseFlippable
id: ClothingHeadHeadHatBaseFlipped
Expand Down Expand Up @@ -98,7 +98,7 @@
parent: [ClothingHeadHeadHatBaseFlipped, ClothingHeadHatQMsoft]
id: ClothingHeadHatQMsoftFlipped
name: quartermaster's cap

- type: entity
parent: ClothingHeadHeadHatBaseFlippable
id: ClothingHeadHatCorpsoft
Expand Down Expand Up @@ -285,7 +285,7 @@
parent: [ClothingHeadHeadHatBaseFlipped, ClothingHeadHatBizarreSoft]
id: ClothingHeadHatBizarreSoftFlipped
name: troublemaker's cap

- type: entity
parent: ClothingHeadHeadHatBaseFlippable
id: ClothingHeadHatParamedicsoft
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,6 @@
Heat: 8
soundHit:
collection: WeakHit
soundForce: true

- type: entity
name : syndie plasma
Expand Down Expand Up @@ -1107,7 +1106,6 @@
Heat: 20
soundHit:
collection: WeakHit
soundForce: true

# Sunrise-AEG
- type: entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"name": "icon"
},
{
"name": "icon-flipped"
"name": "icon_flipped"
},
{
"name": "equipped-HELMET",
Expand Down
2 changes: 1 addition & 1 deletion Resources/Textures/Clothing/Head/Soft/qmsoft.rsi/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"name": "icon"
},
{
"name": "icon-flipped"
"name": "icon_flipped"
},
{
"name": "equipped-HELMET",
Expand Down
80 changes: 80 additions & 0 deletions Tools/automatic_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env python3

import sys
import yaml
import re
import datetime
from typing import List, Any

MAX_ENTRIES = 500
HEADER_RE = r"(?::cl:|🆑)\s*(.*)"
ENTRY_RE = r"^ *[*-] *(add|remove|tweak|fix): *(.*)"

class NoDatesSafeLoader(yaml.SafeLoader):
@classmethod
def remove_implicit_resolver(cls, tag_to_remove):
if not 'yaml_implicit_resolvers' in cls.__dict__:
cls.yaml_implicit_resolvers = cls.yaml_implicit_resolvers.copy()

for first_letter, mappings in cls.yaml_implicit_resolvers.items():
cls.yaml_implicit_resolvers[first_letter] = [(tag, regexp)
for tag, regexp in mappings
if tag != tag_to_remove]

NoDatesSafeLoader.remove_implicit_resolver('tag:yaml.org,2002:timestamp')

def parse_changelog(pr_body: str) -> List[dict]:
header_match = re.search(HEADER_RE, pr_body, re.MULTILINE)
if not header_match:
return []

changelog_entries = []
for match in re.finditer(ENTRY_RE, pr_body, re.MULTILINE):
changelog_entries.append({
'type': match.group(1),
'description': match.group(2)
})

return changelog_entries

def update_changelog(changelog_file: str, pr_body: str):
new_entries = parse_changelog(pr_body)
if not new_entries:
print("No changelog entries found.")
return

with open(changelog_file, "r", encoding="utf-8-sig") as f:
current_data = yaml.load(f, Loader=NoDatesSafeLoader)

if current_data is None:
entries_list = []
else:
entries_list = current_data.get("Entries", [])

max_id = max(map(lambda e: e.get("id", 0), entries_list), default=0)

for entry in new_entries:
max_id += 1
entry["id"] = max_id
entry["time"] = datetime.datetime.now(datetime.timezone.utc).isoformat()
entry["author"] = "VigersRay" # Update to extract actual author if needed
entries_list.append(entry)

entries_list.sort(key=lambda e: e["id"])

overflow = len(entries_list) - MAX_ENTRIES
if overflow > 0:
entries_list = entries_list[overflow:]

new_data = {"Entries": entries_list}
with open(changelog_file, "w", encoding="utf-8-sig") as f:
yaml.safe_dump(new_data, f)

if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: update_changelog.py <pr_body> <changelog_file>")
sys.exit(1)

pr_body = sys.argv[1]
changelog_file = sys.argv[2]
update_changelog(changelog_file, pr_body)

0 comments on commit 76ee898

Please sign in to comment.