Skip to content

Commit

Permalink
Merge branch 'AdventureTimeSS14:master' into update_readmi
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrodinger71 authored Jun 27, 2024
2 parents b315c44 + 68438fa commit 3e7c659
Show file tree
Hide file tree
Showing 10 changed files with 2,128 additions and 38 deletions.
40 changes: 29 additions & 11 deletions .github/workflows/auto-cl-update-atd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,63 @@ on:

permissions:
contents: write
pull-requests: read
pull-requests: write

jobs:
post_merge_job:
name: Post-Merge Job
name: Auto CL update
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Pull latest changes for update-changelog branch
run: |
git fetch origin
git checkout -b update-changelog || git checkout update-changelog
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Get PR Information
id: pr_info
run: |
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
- name: Install requirements
run: pip install requests pyyaml

- name: Run post-merge script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python Tools/ATD/auto_cl.py "${{ env.GITHUB_TOKEN }}" "${{ github.repository }}" "${{ env.PR_NUMBER }}"
run: python Tools/ATD/auto_cl.py "${{ env.GITHUB_TOKEN }}" "${{ github.repository }}"

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit changes
id: commit-changes
run: |
git add .
git commit -m "Auto cl update" || echo "No changes to commit"
git diff-index --quiet HEAD || git commit -m "Auto cl update"
continue-on-error: true

- name: Push changes
- name: Push changes to a new branch
if: steps.commit-changes.outcome == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:master
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} update-changelog --force
- name: Create Pull Request
if: steps.commit-changes.outcome == 'success'
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: master
branch: update-changelog
commit-message: "Auto cl update"
title: "Auto CL update"
body: "No cl, no fun"
labels: "auto-update changelog"
continue-on-error: true
5 changes: 0 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@
path = RobustToolbox
url = https://github.com/space-wizards/RobustToolbox.git
branch = master
[submodule "Secrets"]
path = Secrets
url = [email protected]:corvax-project/secrets.git
branch = master
update = none
1 change: 1 addition & 0 deletions Content.Client/Credits/CreditsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void AddSection(string title, string path, bool markup = false)
}

AddSection(Loc.GetString("credits-window-contributors-section-title"), "GitHub.txt");
AddSection(Loc.GetString("credits-window-devADT-section-title"), "ADTeam.txt"); // ADT team
AddSection(Loc.GetString("credits-window-codebases-section-title"), "SpaceStation13.txt");
AddSection(Loc.GetString("credits-window-tts-title"), "TTS.txt"); // Corvax-TTS
AddSection(Loc.GetString("credits-window-original-remake-team-section-title"), "OriginalRemake.txt");
Expand Down
2,048 changes: 2,048 additions & 0 deletions Resources/Changelog/ChangelogADT.yml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Resources/Credits/ADTeam.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Adventure Time Development
xTray85, Big_Chungus, Nopeengener, Schrodinger71, Friskis, Modern.df, Aserovich, JustKekc,
xelasto, Stepka, Kotя, Кусь, dikiybanan, Bolper, RevengenRat, Tamioki, AnderFan, Nezer,
Username228, eddiemercury, TORGOVEC471, TORGOVEC471
2 changes: 1 addition & 1 deletion Resources/Credits/GitHub.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0x6273, 2013HORSEMEATSCANDAL, 20kdc, 21Melkuu, 4dplanner, 612git, 778b, Ablankmann, Acruid, actioninja, adamsong, Admiral-Obvious-001, Adrian16199, Aerocrux, Aeshus, Aexxie, Afrokada, Agoichi, Ahion, AJCM-git, AjexRose, Alekshhh, AlexMorgan3817, AlexUm418, AlmondFlour, AlphaQwerty, Altoids1, amylizzle, ancientpower, ArchPigeon, Arendian, arimah, Arteben, AruMoon, as334, AsikKEsel, asperger-sind, aspiringLich, avghdev, AzzyIsNotHere, BananaFlambe, Baptr0b0t, BasedUser, beck-thompson, BellwetherLogic, BGare, bhenrich, BingoJohnson-zz, BismarckShuffle, Bixkitts, Blackern5000, Blazeror, blueDev2, Boaz1111, BobdaBiscuit, brainfood1183, Brandon-Huu, Bright0, brndd, BubblegumBlue, BYONDFuckery, c4llv07e, CakeQ, Callmore, CaptainSqrBeard, Carbonhell, CatTheSystem, Centronias, chairbender, Charlese2, Cheackraze, cheesePizza2, Chief-Engineer, chromiumboy, Chronophylos, Ciac32, clement-or, Clyybber, Cojoke-dot, ColdAutumnRain, collinlunn, ComicIronic, coolmankid12345, corentt, crazybrain23, creadth, CrigCrag, Crotalus, CrudeWax, CrzyPotato, Cyberboss, d34d10cc, Daemon, daerSeebaer, dahnte, dakamakat, dakimasu, DamianX, DangerRevolution, daniel-cr, Darkenson, DawBla, dch-GH, Deahaka, DEATHB4DEFEAT, DeathCamel58, deathride58, DebugOk, Decappi, deepdarkdepths, deepy, Delete69, deltanedas, DerbyX, DexlerXD, dffdff2423, Doctor-Cpu, DoctorBeard, DogZeroX, dontbetank, Doomsdrayk, Doru991, DoubleRiceEddiedd, DoutorWhite, DrMelon, DrSmugleaf, drteaspoon420, DTanxxx, DubiousDoggo, Duddino, Dutch-VanDerLinde, Easypoller, eclips_e, EdenTheLiznerd, EEASAS, Efruit, ElectroSR, elthundercloud, Emisse, EmoGarbage404, Endecc, enumerate0, eoineoineoin, ERORR404V1, Errant-4, estacaoespacialpirata, exincore, exp111, Fahasor, FairlySadPanda, ficcialfaint, Fildrance, FillerVK, Fishfish458, Flareguy, FluffiestFloof, FluidRock, FoLoKe, fooberticus, Fortune117, freeman2651, Froffy025, Fromoriss, FungiFellow, GalacticChimp, gbasood, Geekyhobo, Genkail, Ghagliiarghii, Git-Nivrak, github-actions[bot], gituhabu, GNF54, Golinth, GoodWheatley, Gotimanga, graevy, GreyMario, gusxyz, Gyrandola, h3half, Hanzdegloker, Hardly3D, harikattar, Hebiman, Henry12116, HerCoyote23, hitomishirichan, Hmeister-real, HoofedEar, hord-brayden, hubismal, Hugal31, Huxellberger, Hyenh, iacore, IamVelcroboy, icekot8, igorsaux, ike709, Illiux, Ilya246, IlyaElDunaev, Injazz, Insineer, IntegerTempest, Interrobang01, IProduceWidgets, ItsMeThom, Jackal298, Jackrost, jamessimo, janekvap, Jark255, JerryImMouse, Jessetriesagain, jessicamaybe, Jezithyr, jicksaw, JiimBob, JoeHammad1844, JohnGinnane, johnku1, joshepvodka, jproads, Jrpl, juliangiebel, JustArt1m, JustCone14, JustinTrotter, K-Dynamic, KaiShibaa, kalane15, kalanosh, Kelrak, kerisargit, keronshb, KIBORG04, Killerqu00, KingFroozy, kira-er, Kit0vras, KittenColony, Ko4ergaPunk, komunre, koteq, Krunklehorn, Kukutis96513, kxvvv, Lamrr, LankLTE, lapatison, Leander-0, LetterN, Level10Cybermancer, lever1209, liltenhead, LittleBuilderJane, Lomcastar, LordCarve, LordEclipse, luckyshotpictures, Lukasz825700516, lunarcomets, luringens, lvvova1, lzimann, lzk228, MACMAN2003, Macoron, MagnusCrowe, ManelNavola, Mangohydra, Matz05, MehimoNemo, MeltedPixel, MemeProof, Menshin, Mervill, metalgearsloth, mhamsterr, MilenVolf, Minty642, Mirino97, mirrorcult, misandrie, MishaUnity, MisterMecky, Mith-randalf, MjrLandWhale, Moneyl, Moomoobeef, moony, Morb0, Mr0maks, musicmanvr, Myakot, Myctai, N3X15, Nairodian, Naive817, namespace-Memory, NickPowers43, nikthechampiongr, Nimfar11, Nirnael, nmajask, nok-ko, Nopey, notafet, notquitehadouken, noudoit, noverd, nuke-haus, NULL882, OctoRocket, OldDanceJacket, onoira, osjarw, Owai-Seek, pali6, Pangogie, patrikturi, PaulRitter, Peptide90, peptron1, Phantom-Lily, pigeonpeas, pissdemon, PixelTheKermit, PJB3005, Plykiya, pofitlo, pointer-to-null, PolterTzi, PoorMansDreams, potato1234x, ProfanedBane, PrPleGoo, ps3moira, Psychpsyo, psykzz, PuroSlavKing, PursuitInAshes, quatre, QuietlyWhisper, qwerltaz, Radosvik, Radrark, Rainbeon, Rainfey, RamZ, Rane, ravage123321, rbertoche, Redict, RedlineTriad, RednoWCirabrab, RemberBM, RemieRichards, RemTim, rene-descartes2021, RiceMar1244, RieBi, Rinkashikachi, Rockdtben, rolfero, rosieposieeee, RumiTiger, Saakra, Samsterious, SaphireLattice, ScalyChimp, scrato, Scribbles0, Serkket, SethLafuente, ShadowCommander, Shadowtheprotogen546, shampunj, SignalWalker, Simyon264, Sirionaut, siyengar04, Skarletto, Skrauz, Skyedra, SlamBamActionman, slarticodefast, Slava0135, snebl, Snowni, snowsignal, SonicHDC, SoulFN, SoulSloth, SpaceManiac, SpeltIncorrectyl, SphiraI, spoogemonster, ssdaniel24, Stealthbomber16, StrawberryMoses, superjj18, SweptWasTaken, Szunti, takemysoult, TaralGit, Tayrtahn, tday93, TekuNut, TemporalOroboros, tentekal, Terraspark4941, tgrkzus, thatrandomcanadianguy, TheArturZh, theashtronaut, thedraccx, themias, theomund, theOperand, TheShuEd, TimrodDX, Titian3, tkdrg, tmtmtl30, TokenStyle, tom-leys, tomasalves8, Tomeno, Tornado-Technology, tosatur, TsjipTsjip, Tunguso4ka, TurboTrackerss14, Tyler-IN, Tyzemol, UbaserB, UBlueberry, UKNOWH, Uriende, UristMcDorf, Vaaankas, Varen, VasilisThePikachu, veliebm, Veritius, Vermidia, Verslebas, VigersRay, Visne, volundr-, Voomra, Vordenburg, vulppine, wafehling, waylon531, weaversam8, whateverusername0, Willhelm53, wixoaGit, WlarusFromDaSpace, wrexbe, xRiriq, yathxyz, Ygg01, YotaXP, YuriyKiss, zach-hill, Zandario, Zap527, Zealith-Gamer, ZelteHonor, zerorulez, zionnBE, zlodo, ZNixian, ZoldorfTheWizard, Zonespace27, Zumorica, Zymem
AdventureTimeSS14
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/changelog/changelog-window.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ changelog-version-tag = версия v{ $version }
changelog-button = Обновления
changelog-button-new-entries = Обновления (!)
changelog-tab-title-Changelog = Список изменений
changelog-tab-title-ChangelogADT = Время Приключений
changelog-tab-title-Admin = Админское
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/credits/credits-window.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ credits-window-become-patron-button = Стать спонсором
credits-window-contributor-encouragement-label = Хотите попасть в этот список?
credits-window-contribute-button = Внесите свой вклад!
credits-window-contributors-section-title = Контрибьюторы Space Station 14
credits-window-devADT-section-title = Сделавшие вклад в кодовую базу Adventure Time
credits-window-codebases-section-title = Код Space Station 13
credits-window-original-remake-team-section-title = Команда ремейка оригинальной Space Station 13
credits-window-special-thanks-section-title = Особая благодарность
1 change: 0 additions & 1 deletion Secrets
Submodule Secrets deleted from 7bdcea
63 changes: 43 additions & 20 deletions Tools/ATD/auto_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

MAX_ENTRIES = 500
CHANGELOG_PATH = os.path.join(os.path.dirname(__file__), '../../Resources/Changelog/ChangelogADT.yml')
OLD_CHANGELOG_PATH = os.path.join(os.path.dirname(__file__), 'cl_old.yml')

class NoDatesSafeLoader(yaml.SafeLoader):
@classmethod
Expand Down Expand Up @@ -50,6 +51,19 @@ def get_pr_info(token, repo, pr_number):
else:
response.raise_for_status()

def get_latest_pr_number(token, repo):
url = f"https://api.github.com/repos/{repo}/pulls?state=all&sort=created&direction=desc&per_page=1"
headers = {
"Authorization": f"token {token}",
"Accept": "application/vnd.github.v3+json"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
pr_list = response.json()
if pr_list:
return pr_list[0]['number']
response.raise_for_status()

def load_yaml(file_path):
if os.path.exists(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
Expand Down Expand Up @@ -77,18 +91,22 @@ def fetch_pr_data(token, repo, pr_number):
def fetch_single_pr(number):
try:
pr_info = get_pr_info(token, repo, number)

# Проверяем, что PR был замержен
if not pr_info.get('merged_at'):
return None

body = pr_info.get('body', '')
cl_match = re.search(r':cl:\s*(.*)', body)
if not cl_match:
return None

author = cl_match.group(1).strip() or pr_info['user']['login']


# Находим строку, которая начинается с :cl:
author = pr_info['user']['login']
for line in body.splitlines():
if line.strip().startswith(':cl:'):
potential_author = line.strip()[4:].strip() # Убираем :cl: и пробелы
if potential_author:
author = potential_author
break

changes = []
for line in body.splitlines():
line = line.strip()
Expand All @@ -100,7 +118,7 @@ def fetch_single_pr(number):
changes.append({"message": line[len('- tweak:'):].strip(), "type": "Tweak"})
elif line.startswith('- fix:'):
changes.append({"message": line[len('- fix:'):].strip(), "type": "Fix"})

if changes:
return {
"author": author,
Expand All @@ -124,12 +142,14 @@ def fetch_single_pr(number):
return pr_data

def update_cl_file(file_path, new_data):
cl_old_data = load_yaml(file_path)
existing_entries = cl_old_data.get("Entries", [])
if os.path.exists(file_path):
os.remove(file_path)

old_entries = load_yaml(OLD_CHANGELOG_PATH).get("Entries", [])

# Calculate the next ID based on existing entries
if existing_entries:
next_id = max(entry['id'] for entry in existing_entries) + 1
if old_entries:
next_id = max(entry['id'] for entry in old_entries) + 1
else:
next_id = 1

Expand All @@ -138,8 +158,8 @@ def update_cl_file(file_path, new_data):
entry['id'] = next_id
next_id += 1

# Combine and reorder entries
combined_data = existing_entries + new_data
# Combine old entries and new data
combined_data = old_entries + new_data

# Ensure we do not exceed MAX_ENTRIES
if len(combined_data) > MAX_ENTRIES:
Expand All @@ -149,19 +169,22 @@ def update_cl_file(file_path, new_data):
combined_data = strip_newlines(combined_data)

# Save the updated data back to ChangelogADT.yml
cl_old_data["Entries"] = combined_data
save_yaml(cl_old_data, file_path)
save_yaml({"Entries": combined_data}, file_path)

logging.info("Updated PR data saved to ChangelogADT.yml")

def main():
if len(sys.argv) != 4:
logging.error("Usage: auto_cl.py <GITHUB_TOKEN> <REPO> <PR_NUMBER>")
if len(sys.argv) < 3:
logging.error("Usage: auto_cl.py <GITHUB_TOKEN> <REPO>")
sys.exit(1)

github_token = sys.argv[1]
repo = sys.argv[2]
pr_number = int(sys.argv[3])

pr_number = get_latest_pr_number(github_token, repo)
if pr_number is None:
logging.error("Failed to get the latest PR number")
sys.exit(1)

pr_data = fetch_pr_data(github_token, repo, pr_number)

Expand Down

0 comments on commit 3e7c659

Please sign in to comment.