[MIRROR] Experimental: adds workflow to autoupdate changelog

This commit is contained in:
Chompstation Bot
2021-01-13 00:28:47 +00:00
parent dbfd7eca4f
commit 3018b622d3
11 changed files with 168 additions and 196 deletions

39
.github/workflows/autochangelog.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Autochangelog
on:
pull_request:
types: closed
branches:
- master
env:
BASENAME: "polaris"
jobs:
autochangelog:
name: Autochangelog
runs-on: ubuntu-16.04
if: github.event.pull_request.merged == true
steps:
- uses: /actions/checkout@v2
- name: Ensure +x on CI directory
run: |
chmod -R +x ./tools/ci
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Generate Changelog
run: |
pip install pyyaml
python tools/GenerateChangelog/ss13_autochangelog.py \
html/changelogs \
${{ github.event.pull_request.number }} \
"${{ github.event.pull_request.user.login }}" \
"${{ github.event.pull_request.body }}"
python tools/GenerateChangelog/ss13_genchangelog.py \
html/changelog.html \
html/changelogs
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automatic changelog generation for ${{ github.events.pull_request.number }}
branch: ${{ github.events.pull_request.base }}
commit_user_name: Autochangelog Bot

View File

@@ -1,36 +1,4 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Cerebulon
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- soundadd: "Added button sounds to various machines."

View File

@@ -1,37 +1,5 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: KasparoVy
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- imageadd: Adds orange Teshari goggles, selectable in the loadout.
- imageadd: Adds blindfold & new white (recolorable) blindfold to loadout.
@@ -42,4 +10,4 @@ changes:
- rscadd: Adds a bunch of Teshari worksuits (sprites already existed).
- imageadd: Adds some species-fitted Teshari jacket accessories (tan, charcoal, navy, burgundy, checkered).
- tweak: Updates all Teshari undercoats and cloaks with new sprites from downstreams.
- fix: Fixes Teshari captain glove sprites.
- bugfix: Fixes Teshari captain glove sprites.

View File

@@ -1,36 +1,4 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Mechoid
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Added system for exosuit over-encumbrance. Combat mechs and Ripleys have higher than default."

View File

@@ -1,4 +1,4 @@
author: Meghan-Rossi
delete-after: True
changes:
- rscadd: "The Tesla Generator is now available from cargo. Coils and grounding rods for it may be printed on the protolathe and autolathe, respectively."
- rscadd: "The Tesla Generator is now available from cargo. Coils and grounding rods for it may be printed on the protolathe and autolathe, respectively."

View File

@@ -1,37 +1,5 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: N3X15
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
author: RunaDacino
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Enabled research borgs equipped with 'exosuit gripper' to be able to replace internal exosuit parts like actuators, to upgrade or to repair"

View File

@@ -1,36 +1,4 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Subber
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Added two new antag augments to traitor uplink: armblade and handblade."

View File

@@ -0,0 +1,4 @@
author: Woodrat
delete-after: True
changes:
- tweak: "Changes vote notification sound to that of World Server in order to help people realize there is a vote occurring."

View File

@@ -34,4 +34,4 @@ delete-after: True
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Animals can be butchered for organs and hide. Requires scraping (sharp), washing (water or washing machine), and then drying (bonfire or drying rack)."
- rscadd: "Organs can be butchered for meat, named "[organ] meat". Heart meat, liver meat, etc. Brains from player mobs cannot be butchered."
- rscadd: "Organs can be butchered for meat, named \"[organ] meat\". Heart meat, liver meat, etc. Brains from player mobs cannot be butchered."

View File

@@ -1,37 +1,5 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Mechoid
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Adds Wurmwoad, a suspiciously worm-like plant that produces pods of spice."
- rscadd: "Adds Wurmwoad to the service borg synthesizer."

View File

@@ -0,0 +1,121 @@
'''
Usage:
$ python ss13_autochangelog.py [--dry-run] html/changelogs [PR_number] [PR_author] [PR_Body]
ss13_autochangelog.py - Generate changelog YAML files from pull request.
'''
from __future__ import print_function
import os, sys, re, time, argparse
from datetime import datetime, date
from time import time
today = date.today()
dateformat = "%d %B %Y"
opt = argparse.ArgumentParser()
opt.add_argument('target_dir', help='The location to write changelog files to.')
opt.add_argument('pr_numb', help='The number of the pull request.')
opt.add_argument('pr_author', help='The author of the pull request. If specific authors aren\'t specified, the PR author will be used')
opt.add_argument('pr_body', help='The body of the pull request to parse for changelogs.')
args = opt.parse_args()
all_changelog_entries = {}
validPrefixes = {
"fix": 'bugfix',
"fixes": 'bugfix',
"bugfix": 'bugfix',
"wip": 'wip',
"tweak": 'tweak',
"tweaks": 'tweak',
"rsctweak": 'tweak',
"soundadd": 'soundadd',
"sounddel": 'sounddel',
"add": 'rscadd',
"adds": 'rscadd',
"rscadd": 'rscadd',
"del": 'rscdel',
"dels": 'rscdel',
"delete": 'rscdel',
"deletes": 'rscdel',
"rscdeldel": 'rscdel',
"imageadd": 'imageadd',
"imagedel": 'imagedel',
"maptweak": 'maptweak',
"remap": 'maptweak',
"remaps": 'maptweak',
"typo": 'spellcheck',
"spellcheck": 'spellcheck',
"experimental": 'experiment',
"experiments": 'experiment',
"experiment": 'experiment'
}
incltag = False
new_logs = {}
author = args.pr_author
new = 0
# Parse PR body for changelog entries
print('Reading changelogs...')
for line in args.pr_body.splitlines():
print(f"Checking line '{line}'")
if line[0] == "🆑": # Find the start of the changelog
print("Found opening :cl: tag")
if incltag == True: # If we're already reading logs, skip
continue
incltag = True
# Fetch the author name
author = line[1:]
author.strip()
if not len(author):
author = args.pr_author
if author not in new_logs:
new_logs[author] = [] # Make array entry for the author
continue
# If we hit a /cl, we're no longer reading logs
elif line == "/🆑":
print("Found closing /:cl: tag")
incltag = False
# If we aren't reading logs, we don't care about any other line contents
if not incltag:
continue
# Split line into tag (icon) and body (comment)
body = re.split("[ ,:-]", line, 1)
if len(body) != 2:
continue # If there's just one word, then it can't really be a changelog, now can it
if body[0] in validPrefixes:
tag = validPrefixes[body[0]]
body = body[1].strip(" ,-:\t\n")
else: # If the tag is invalid, just default to rscadd
tag = "rscadd"
body = line.strip(" ,-:\t\n")
new_logs[author].append(f" - {tag}: \"{body}\"")
new += 1
print(f"Writing {new} new changelog entries.") # f supposedly formats new into the var
for auth in new_logs:
# Sanitize authors without changes
if not len(new_logs[auth]):
continue
f = open(os.path.join(args.target_dir, f"{auth}{args.pr_numb}.yml"), 'w')
print(f"Writing changes to {f}")
f.write(f'author: {auth}\n')
f.write('delete-after: True\n')
f.write('changes:\n')
for log in new_logs[auth]:
f.write(f'{log}\n')
f.close()