From 3c55b3b909e7a06cc6da52d655363b829194e402 Mon Sep 17 00:00:00 2001 From: TAZIKLIK <73418250+Evgencheg@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:44:20 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D0=BC=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B8=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/changelog.yml | 6 ++ .github/workflows/publish-lostparadise.yml | 6 -- .../Chat/Managers/ChatSanitizationManager.cs | 59 +++++++++++++++---- Tools/actions_changelogs_since_last_run.py | 16 ++++- Tools/changelogs/changelog.js | 2 +- 5 files changed, 69 insertions(+), 20 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 69318fd977..847ec35ed9 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -53,3 +53,9 @@ jobs: git push shell: bash continue-on-error: true + + - name: Publish changelog + run: Tools/actions_changelogs_since_last_run.py + env: + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} + CHANGELOG_DISCORD_WEBHOOK: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }} diff --git a/.github/workflows/publish-lostparadise.yml b/.github/workflows/publish-lostparadise.yml index b7323f7a21..2b041bfbea 100644 --- a/.github/workflows/publish-lostparadise.yml +++ b/.github/workflows/publish-lostparadise.yml @@ -64,9 +64,3 @@ jobs: key: ${{ secrets.SSH }} port: ${{ secrets.PORT }} script: pwsh /var/www/wiki/push.ps1 ${{ github.sha }} - - - name: Publish changelog - run: Tools/actions_changelogs_since_last_run.py - env: - BOT_TOKEN: ${{ secrets.BOT_TOKEN }} - CHANGELOG_DISCORD_WEBHOOK: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }} diff --git a/Content.Server/Chat/Managers/ChatSanitizationManager.cs b/Content.Server/Chat/Managers/ChatSanitizationManager.cs index 57e759c6ac..eb53d0b03a 100644 --- a/Content.Server/Chat/Managers/ChatSanitizationManager.cs +++ b/Content.Server/Chat/Managers/ChatSanitizationManager.cs @@ -12,6 +12,41 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager private static readonly Dictionary SmileyToEmote = new() { // I could've done this with regex, but felt it wasn't the right idea. + { "хд", "chatsan-laughs" }, + { "о-о", "chatsan-wide-eyed" }, // cyrillic о + { "о.о", "chatsan-wide-eyed" }, // cyrillic о + { "0_о", "chatsan-wide-eyed" }, // cyrillic о + { "о/", "chatsan-waves" }, // cyrillic о + { "о7", "chatsan-salutes" }, // cyrillic о + { "0_o", "chatsan-wide-eyed" }, + { "лмао", "chatsan-laughs" }, + { "рофл", "chatsan-laughs" }, + { "яхз", "chatsan-shrugs" }, + { ":0", "chatsan-surprised" }, + { ":р", "chatsan-stick-out-tongue" }, // cyrillic р + { "кек", "chatsan-laughs" }, + { "T_T", "chatsan-cries" }, + { "Т_Т", "chatsan-cries" }, // cyrillic T + { "=_(", "chatsan-cries" }, + { "!с", "chatsan-laughs" }, + { "!в", "chatsan-sighs" }, + { "!х", "chatsan-claps" }, + { "!щ", "chatsan-snaps" }, + { "))", "chatsan-smiles-widely" }, + { ")", "chatsan-smiles" }, + { "((", "chatsan-frowns-deeply" }, + { "(", "chatsan-frowns" }, + // Corvax-Localization-End + // Lost-Paradise-Localization-Start + { "орууу", "chatsan-laughs" }, + { "хз", "chatsan-shrugs" }, + { "хсс", "chatsan-shrugs" }, + { "хссс", "chatsan-shrugs" }, + { "шшш", "chatsan-hiss" }, + { "авууу", "chatsan-awoo" }, + { "няяя", "chatsan-nyaaa" }, + // Lost-Paradise-Localization-End + // I could've done this with regex, but felt it wasn't the right idea. { ":)", "chatsan-smiles" }, { ":]", "chatsan-smiles" }, { "=)", "chatsan-smiles" }, @@ -68,19 +103,19 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager { "^^/", "chatsan-waves" }, { ":/", "chatsan-uncertain" }, { ":\\", "chatsan-uncertain" }, - { "лмао", "chatsan-laughs" }, - { "лмао.", "chatsan-laughs" }, - { "лол", "chatsan-laughs" }, - { "лол.", "chatsan-laughs" }, - { "хД", "chatsan-laughs" }, - { "хД.", "chatsan-laughs" }, - { "кек", "chatsan-laughs" }, - { "кек.", "chatsan-laughs" }, - { "рофл", "chatsan-laughs" }, - { "о7", "chatsan-salutes" }, + { "lmao", "chatsan-laughs" }, + { "lmao.", "chatsan-laughs" }, + { "lol", "chatsan-laughs" }, + { "lol.", "chatsan-laughs" }, + { "lel", "chatsan-laughs" }, + { "lel.", "chatsan-laughs" }, + { "kek", "chatsan-laughs" }, + { "kek.", "chatsan-laughs" }, + { "rofl", "chatsan-laughs" }, + { "o7", "chatsan-salutes" }, { ";_;7", "chatsan-tearfully-salutes"}, - { "хз", "chatsan-shrugs" }, - { "хз.", "chatsan-shrugs" }, + { "idk", "chatsan-shrugs" }, + { "idk.", "chatsan-shrugs" }, { ";)", "chatsan-winks" }, { ";]", "chatsan-winks" }, { "(;", "chatsan-winks" }, diff --git a/Tools/actions_changelogs_since_last_run.py b/Tools/actions_changelogs_since_last_run.py index a00b40d7a5..2bb113e9f2 100755 --- a/Tools/actions_changelogs_since_last_run.py +++ b/Tools/actions_changelogs_since_last_run.py @@ -18,6 +18,7 @@ GITHUB_TOKEN = os.environ["GITHUB_TOKEN"] CHANGELOG_DIR = os.environ["CHANGELOG_DIR"] CHANGELOG_DISCORD_WEBHOOK = os.environ["CHANGELOG_DISCORD_WEBHOOK"] +PR_NUMBER = os.environ["PR_NUMBER"] # https://discord.com/developers/docs/resources/webhook DISCORD_SPLIT_LIMIT = 2000 @@ -40,8 +41,21 @@ def main(): session.headers["Accept"] = "Accept: application/vnd.github+json" session.headers["X-GitHub-Api-Version"] = "2022-11-28" + resp = session.get(f"{GITHUB_API_URL}/repos/{GITHUB_REPOSITORY}/pulls/{PR_NUMBER}") + resp.raise_for_status() + last_sha = resp.json()["merge_commit_sha"] + + index = int(PR_NUMBER) + while True: + index -= 1 + resp = session.get(f"{GITHUB_API_URL}/repos/{GITHUB_REPOSITORY}/pulls/{index}") + resp.raise_for_status() + merge_info = resp.json() + if merge_info["merged_at"]: + last_sha = merge_info["merge_commit_sha"] + break + most_recent = get_most_recent_workflow(session) - last_sha = most_recent['head_commit']['id'] print(f"Last successful publish job was {most_recent['id']}: {last_sha}") last_changelog = yaml.safe_load(get_last_changelog(session, last_sha)) with open(CHANGELOG_DIR, "r") as f: diff --git a/Tools/changelogs/changelog.js b/Tools/changelogs/changelog.js index 26e2014c9e..fae2211f44 100644 --- a/Tools/changelogs/changelog.js +++ b/Tools/changelogs/changelog.js @@ -146,7 +146,7 @@ function writeChangelog(entry) { fs.writeFileSync( `../../${process.env.CHANGELOG_DIR}`, "Entries:\n" + - yaml.dump(data.Entries, { indent: 2 }).replace(/^---/, "") + yaml.dump(data.Entries, { indent: 2 }).replace(/^---/, "") ); }