curseforge-mirror / .github

6 stars 2 forks source link

Automate the Generation of Currently Mirrored Addons List #26

Closed srhinos closed 9 months ago

srhinos commented 1 year ago

Referencing this list -- https://github.com/curseforge-mirror/.github/blob/main/README.md

I have a script locally doing this and need to write a GH Action to automate this.

Figured if anyone wants to contribute to the repo / this project they could tackle this before I do,

existing python script for reference so you dont have to guess on format or anything:

from pathlib import Path

root_path = Path("./")
template_path = root_path / "template" / ".github" / "workflows" / "setup-repo.yml"

ignore_file = [".git", "README.md", ".templateversionrc", "setup.json", "__pycache__"]
ignore_addons = [
    "BetterTooltips",
    "BetterWardrobe",
    "BGHistorian",
    "wow-dialogkey",
    "ViragDevTool",
    "opie",
    "tldr-missions",
    "tldrmissions",
    "venture-plan",
]
ignore_misc = [
    "template",
    ".github",
    "actions-template-sync",
    "this.py",
    "this.sh",
    "cloudscraper",
]
ignore_folder = ignore_addons + ignore_misc
to_use = "setup-repo.yml"

out_str = "| [{0}](https://github.com/curseforge-mirror/{0}) | [![workflow badge](https://github.com/curseforge-mirror/{0}/actions/workflows/main.yml/badge.svg)](https://github.com/curseforge-mirror/{0}/actions/workflows/main.yml) | [![workflow badge](https://github.com/curseforge-mirror/{0}/actions/workflows/template-sync.yml/badge.svg)](https://github.com/curseforge-mirror/{0}/actions/workflows/template-sync.yml) | [![download badge](https://img.shields.io/github/downloads/curseforge-mirror/{0}/total)](https://github.com/curseforge-mirror/{0}/releases) |"
small_out_str = "| [{0}](https://github.com/curseforge-mirror/{0}) | [![workflow badge](https://github.com/curseforge-mirror/{0}/actions/workflows/main.yml/badge.svg)](https://github.com/curseforge-mirror/{0}/actions/workflows/main.yml) | n/a | [![download badge](https://img.shields.io/github/downloads/curseforge-mirror/{0}/total)](https://github.com/curseforge-mirror/{0}/releases) |"
[print(small_out_str.format(f.name) if f.name in ignore_addons else out_str.format(f.name)) for f in root_path.iterdir() if f.name not in ignore_misc]

Script works by cloning all repos in the org locally and running it at the org wide directory. Quick snippet to do this: gh repo list curseforge-mirror --limit 1000 | while read -r repo _; do gh repo clone "$repo" "$repo"; done

ChrisKader commented 1 year ago

I would be happy to help take this on. I am also interested in updating code so that new GitHub releases are not created unless an addon has an actual new release on CurseForge.

A good example of this behavior can be seen here. OmniCD has not been updated since October 23, 2022. However, new GH release keep getting created. Since CurseForge gives each file a unique ID, this will be easy to implement.

srhinos commented 1 year ago

Totally! Feel free to take a crack at either or, would prefer the generation of repos to live in this repo and the updated code only generate releases when a new version exists in the template repo!

If you need any help testing either, feel free to shoot me a note on discord @ either SexualRhinoceros#0001 or join discord.gg/rhino and shoot me a DM that way!

srhinos commented 9 months ago

a year and a half later, I knocked this out. Should be relatively autonomous running on a cron job CI runner and will auto update the readme every 24 hrs keeping it up to date and generate a changelog as a release only when there was changes.