workflo 2
This commit is contained in:
parent
c6941a9e3f
commit
59716ec8f5
2 changed files with 28 additions and 4 deletions
|
@ -14,6 +14,22 @@ count["both"] = 0
|
|||
|
||||
cache = dict()
|
||||
|
||||
class fragile(object):
|
||||
class Break(Exception):
|
||||
"""Break out of the with statement"""
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
def __enter__(self):
|
||||
return self.value.__enter__()
|
||||
|
||||
def __exit__(self, etype, value, traceback):
|
||||
error = self.value.__exit__(etype, value, traceback)
|
||||
if etype == self.Break:
|
||||
return True
|
||||
return error
|
||||
|
||||
if os.path.isfile("cache/licenses.json"):
|
||||
with open("cache/licenses.json", "r") as f:
|
||||
cache = json.load(f)
|
||||
|
@ -47,10 +63,10 @@ for mod in glob.glob("pack/mods/*.toml"):
|
|||
count[moddata["side"]] += 1
|
||||
mods[moddata["name"]] = moddata
|
||||
|
||||
with open("wiki/Modlist.md", "w") as f:
|
||||
with fragile(open("wiki/Modlist.md", "w")) as f:
|
||||
if (count["server"] + count["client"] + count["both"]) == 0:
|
||||
f.write("## No mods.")
|
||||
break
|
||||
raise fragile.Break
|
||||
|
||||
f.write("## Total Count\r\n")
|
||||
f.write("<table>")
|
||||
|
@ -104,10 +120,10 @@ with open("wiki/Modlist.md", "w") as f:
|
|||
f.write("\r\n</tr>")
|
||||
f.write("\r\n</table>")
|
||||
|
||||
with open("wiki/Licenses.md", "w") as f:
|
||||
with fragile(open("wiki/Licenses.md", "w")) as f:
|
||||
if (count["server"] + count["client"] + count["both"]) == 0:
|
||||
f.write("## No mods.")
|
||||
break
|
||||
raise fragile.Break
|
||||
|
||||
for mod in mods:
|
||||
data = mods[mod]
|
||||
|
|
8
.forgejo/workflows/restart-server.yaml
Normal file
8
.forgejo/workflows/restart-server.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
name: "Update wiki"
|
||||
on: [push]
|
||||
jobs:
|
||||
restart:
|
||||
if: "contains(github.event.head_commit.message, '[restart]')"
|
||||
name: "Restart server"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
Loading…
Add table
Reference in a new issue