Kir-Antipov / mc-publish

🚀 Your one-stop GitHub Action for seamless Minecraft project publication across various platforms.
MIT License
228 stars 20 forks source link

Cannot publish a modpack to CurseForge #69

Closed Kir-Antipov closed 1 year ago

Kir-Antipov commented 1 year ago

Discussed in https://github.com/Kir-Antipov/mc-publish/discussions/68

Originally posted by **Encode42** May 30, 2023 I'm trying to publish a mod pack to CurseForge, which does not have any files that values can be inferred from (fabric.mod.json, etc.) As such, I'm providing the `game-versions` field myself. This works as expected when publishing to Modrinth, however, the same is not true for CurseForge. When the action runs, the following error appears: ``` Error: HttpError: 400 (Bad Request, {"errorCode":1002,"errorMessage":"Error in field `metadata`:\n* Array item count 0 is less than minimum count of 1. Path \u0027gameVersions\u0027, line 1, position 381."}) ``` [Failing run](https://github.com/Encode42/Natureal/actions/runs/5116059953/jobs/9197848001) Is this user error? Am I misunderstanding how this field works?
Kir-Antipov commented 1 year ago

@Encode42, the error message from CurseForge suggests that the gameVersions field is empty. This isn't a user error, but rather a consequence of the internal rotation of different game version ID variants. This rotation was implemented to cope with inconsistencies in CurseForge's API (refer to issue #42).

For your configuration:

loaders: |
  fabric
game-versions: |
  1.19.2

mc-publish generates the following ID variants:

[
  // 1.19.2 (mods + mod packs), fabric
  [ 9366, 7499 ],

  // 1.19.2 (plugins)
  [ 9560 ],

  // 1.19.2 (addons)
  [ 9551 ],
]

The rotation among these variants is activated when CurseForge returns error code 1009 ("Invalid game version ID: \<ID> belongs to an invalid dependency"). If none of these IDs are accepted by CurseForge, mc-publish will attempt to omit gameVersions entirely, which seems to be the situation in this case. Unfortunately, there's nothing more that can be done if this occurs. This mechanism is functioning as designed. The key question to answer is why CurseForge does not accept the first entry. It works for mods, so it should have also worked for mod packs.

Kir-Antipov commented 1 year ago

Hmmmm.

Warning: W.I.P. CurseForge rejected these game versions: [9366,7499]. HttpError: 400 (Bad Request, {"errorCode":1009,"errorMessage":"Invalid game version ID: 7499 belongs to an invalid dependency."})

7499 is Fabric:

{
  "id": 7499,
  "gameVersionTypeID": 68441,
  "name": "Fabric",
  "slug": "fabric"
}

What the heck is going on here? CurseForge supports specifying loaders for modpacks in their web interface. Why doesn't it via API?