Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/cmss13-devs/cmss13 into h…
Browse files Browse the repository at this point in the history
…uman-resprite
  • Loading branch information
GrrrKitten committed May 30, 2024
2 parents 1f04f3e + a8e1d41 commit 6a3e9d9
Show file tree
Hide file tree
Showing 1,240 changed files with 42,494 additions and 33,887 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# Zonespace

/code/datums/tutorial/ @Zonespace27
/code/modules/admin/verbs/SDQL2/ @Zonespace27
/maps/tutorial/ @Zonespace27

# MULTIPLE OWNERS
158 changes: 88 additions & 70 deletions .github/add_labels.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import os, re
from github import Github
from github import Github, GithubException

# Format - Key: Array[Label, [StringsToIgnore]]
changelogToPrefix = {
'fix': ["Fix", ["fixed a few things"]],
'qol': ["Quality of Life", ["made something easier to use"]],
'add': ["Feature", ["Added new mechanics or gameplay changes", "Added more things"]],
'del': ["Removal", ["Removed old things"]],
'spellcheck': ["Grammar and Formatting", ["fixed a few typos"]],
'balance': ["Balance", ["rebalanced something"]],
'code': ["Code Improvement", ["changed some code"]],
'refactor': ["Refactor", ["refactored some code"]],
'config': ["Config", ["changed some config setting"]],
'admin': ["Admin", ["messed with admin stuff"]],
'server': ["Server", ["something server ops should know"]],
'fix': ["Fix", ["fixed a few things"]],
'qol': ["Quality of Life", ["made something easier to use"]],
'add': ["Feature", ["Added new mechanics or gameplay changes", "Added more things"]],
'del': ["Removal", ["Removed old things"]],
'spellcheck': ["Grammar and Formatting", ["fixed a few typos"]],
'balance': ["Balance", ["rebalanced something"]],
'code': ["Code Improvement", ["changed some code"]],
'refactor': ["Refactor", ["refactored some code"]],
'config': ["Config", ["changed some config setting"]],
'admin': ["Admin", ["messed with admin stuff"]],
'server': ["Server", ["something server ops should know"]],
'soundadd': ["Sound", ["added a new sound thingy"]],
'sounddel': ["Sound", ["removed an old sound thingy"]],
'imageadd': ["Sprites", ["added some icons and images"]],
Expand All @@ -24,78 +24,96 @@
}

fileToPrefix = {
'wav': 'Sound',
'ogg': 'Sound',
'wav': 'Sound',
'ogg': 'Sound',
'mp3': 'Sound', ## Can't believe they forgot about the best sound format
'dmm': 'Mapping',
'dmm': 'Mapping',

'js': 'UI',
'tsx': 'UI',
'ts': 'UI',
'jsx': 'UI',
'scss': 'UI',
'js': 'UI',
'tsx': 'UI',
'ts': 'UI',
'jsx': 'UI',
'scss': 'UI',

'dmi': "Sprites",
'dmi': "Sprites",
}

githubLabel = "Github"
missingLogLabel = "Missing Changelog"

def get_labels(pr):
labels = {}

files = pr.get_files()
for file in files:
prefix = file.filename.split(".")[-1]
if file.filename.startswith(".github"):
labels[githubLabel] = True
if not prefix in fileToPrefix:
continue
labels[fileToPrefix[prefix]] = True

changelog_match = re.search(r"🆑(.*)/🆑", pr.body, re.S | re.M)
if changelog_match is None:
changelog_match = re.search(r":cl:(.*)/:cl:", pr.body, re.S | re.M)
if changelog_match is None:
return labels
lines = changelog_match.group(1).split('\n')
for line in lines:
line = line.strip()
if not line:
continue

contentSplit = line.split(":")

key = contentSplit.pop(0).strip()
content = ":".join(contentSplit).strip()

if not key in changelogToPrefix:
continue

if content in changelogToPrefix[key][1]:
continue

labels[changelogToPrefix[key][0]] = True

return list(labels)
labels = {}
failed = False

files = pr.get_files()
for file in files:
prefix = file.filename.split(".")[-1]
if file.filename.startswith(".github"):
labels[githubLabel] = True
if not prefix in fileToPrefix:
continue
labels[fileToPrefix[prefix]] = True

changelog_match = re.search(r"🆑(.*)/🆑", pr.body, re.S | re.M)
if changelog_match is None:
changelog_match = re.search(r":cl:(.*)/:cl:", pr.body, re.S | re.M)
if changelog_match is None:
print("::warning ::No changelog detected.")
labels[missingLogLabel] = True
return labels, False

lines = changelog_match.group(1).split('\n')
failed = len(lines) <= 2 # Make sure its not an empty changelog
if failed:
print("::error ::Empty changelog.")

for line in lines[1:-1]: # Skip first line with authors and last
line = line.strip()
if not line:
continue

contentSplit = line.split(":")

key = contentSplit.pop(0).strip()
content = ":".join(contentSplit).strip()

if not key in changelogToPrefix: # Some key that we didn't expect
print(f"::error ::Invalid changelog entry: {line}")
failed = True
continue

if content in changelogToPrefix[key][1]: # They left the template entry in
print(f"::error ::Invalid changelog entry: {line}")
failed = True
continue

labels[changelogToPrefix[key][0]] = True

return list(labels), failed

def main():
g = Github(os.environ["TOKEN"])
repo = g.get_repo(os.environ['REPO'])
g = Github(os.environ["TOKEN"])
repo = g.get_repo(os.environ['REPO'])

pr = repo.get_pull(int(os.environ["PR_NUMBER"]))
if not pr:
print("Not a PR.")
return
pr = repo.get_pull(int(os.environ["PR_NUMBER"]))
if not pr:
print("::warning ::Not a PR.")
return

labels = get_labels(pr)
labels, failed = get_labels(pr)

if labels is None: # no labels to add
print("No labels to add.")
return
if not missingLogLabel in labels:
try:
pr.remove_from_labels(missingLogLabel)
except GithubException as e:
if e.status == 404:
pass # 404 if we try to remove a label that isn't set

for label in labels:
pr.add_to_labels(label)
for label in labels:
pr.add_to_labels(label)

if failed:
exit(1)

if __name__ == '__main__':
main()
main()
2 changes: 0 additions & 2 deletions .github/alternate_byond_versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
# Format is version: map
# Example:
# 500.1337: runtimestation

515.1630: lv624
Binary file added .github/assets/discord-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/discord-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/docs-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/docs-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/website-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/website-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/wiki-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/wiki-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Labeling
name: Labeling and Verification
on:
pull_request_target:
types: [opened]
types: [opened, reopened, synchronize, edited]
jobs:
label:
runs-on: ubuntu-latest
Expand All @@ -13,7 +13,7 @@ jobs:
run: |
unset SECRET_EXISTS
if [ -n "$ENABLER_SECRET" ]; then SECRET_EXISTS=true ; fi
echo "::set-output name=ACTIONS_ENABLED::$SECRET_EXISTS"
echo "ACTIONS_ENABLED=$SECRET_EXISTS" >> $GITHUB_OUTPUT
- name: Get The Script
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
Expand All @@ -29,7 +29,7 @@ jobs:
python -m pip install --upgrade pip
python -m pip install pygithub
sudo apt-get install dos2unix
- name: Add Labels
- name: Add and verify labels
if: steps.value_holder.outputs.ACTIONS_ENABLED
run: |
python add_labels.py
Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# We don't want prettier to run on anything outside of the TGUI folder, so we have to do this.
/*

# We want it to run into the TGUI folder, however.
!/tgui
2 changes: 1 addition & 1 deletion .tgs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 1
byond: "514.1588"
byond: "515.1627"
static_files:
- name: config
- name: data
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"eslint.nodePath": "./tgui/.yarn/sdks",
"eslint.workingDirectories": ["./tgui"],
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.js",
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.cjs",
"typescript.tsdk": "./tgui/.yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"search.exclude": {
Expand All @@ -14,6 +14,7 @@
"files.eol": "\n",
"files.insertFinalNewline": true,
"gitlens.advanced.blame.customArguments": ["-w"],
"tgstationTestExplorer.project.resultsType": "json",
"[javascript]": {
"editor.rulers": [80],
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand Down
Loading

0 comments on commit 6a3e9d9

Please sign in to comment.