This pull request includes changes to a GitHub Actions workflow and a
metadata file for a mod. The most important changes are:
Workflow condition update:
*
[`.github/workflows/update-mod-versions.yml`](diffhunk://#diff-08c6175ddce4a9d49c79d12925be3c4f705913aadcd437a10b8bde3bde8fe740L11-R11):
Added a condition to the `update-versions` job to run only if the
repository is `skyline69/balatro-mod-index`.
Metadata update:
*
[`mods/Betmma@BetmmaMods/meta.json`](diffhunk://#diff-91e263ad0127035020f677f4feeeb3759ac5ce30b3a31f27bb0f737629732797L12-R12):
Updated the `version` field from `472b774` to `f082372`.
This PR adds a single-line fix to only run the `update-versions` job
when the repo matches 'skyline69/balatro-mod-index'. This will prevent
the workflow from running automatically in all forks.
This pull request includes several changes to streamline dependency
management, improve workflow efficiency, and update version metadata.
The most important changes include adding a new dependency to the
requirements file, enabling pip caching, modifying the dependency
installation process, and updating the version in the metadata file.
Dependency management improvements:
*
[`.github/scripts/requirements.txt`](diffhunk://#diff-39fb8e148594fb30451d9c14478733efb47cf4bea2eed53c0c3b6a6339c8ef1aR1):
Added the `requests` library to the requirements file.
Workflow efficiency improvements:
*
[`.github/workflows/update-mod-versions.yml`](diffhunk://#diff-08c6175ddce4a9d49c79d12925be3c4f705913aadcd437a10b8bde3bde8fe740R22-R27):
Enabled pip caching to speed up dependency installation.
*
[`.github/workflows/update-mod-versions.yml`](diffhunk://#diff-08c6175ddce4a9d49c79d12925be3c4f705913aadcd437a10b8bde3bde8fe740R22-R27):
Changed the dependency installation command to use the requirements
file.
*
[`.github/workflows/update-mod-versions.yml`](diffhunk://#diff-08c6175ddce4a9d49c79d12925be3c4f705913aadcd437a10b8bde3bde8fe740L47):
Removed an outdated comment regarding the PAT_TOKEN usage.
Metadata update:
*
[`mods/MathIsFun0@Cryptid/meta.json`](diffhunk://#diff-25ebabcdbd959702fcdc951505275bcd041a3f420e961476f09bacd6bf837ccaL13-R13):
Updated the version field to `c795727`.
This pull request includes significant changes to the
`.github/scripts/update_mod_versions.py` script and updates to several
`meta.json` files for various mods. The changes aim to improve the
version checking mechanism and handle GitHub API rate limits more
effectively.
### Improvements to version checking and API rate limit handling:
*
[`.github/scripts/update_mod_versions.py`](diffhunk://#diff-ce76f7bf74b62aaea873670c15651b4caec6662ded3cc8e597cb7e2b1eac67c7L27-R94):
Refactored `get_latest_release` and `get_latest_commit` functions into a
single `get_version_string` function to handle both release and commit
version checks. Added logic to handle GitHub API rate limits and
retries.
[[1]](diffhunk://#diff-ce76f7bf74b62aaea873670c15651b4caec6662ded3cc8e597cb7e2b1eac67c7L27-R94)
[[2]](diffhunk://#diff-ce76f7bf74b62aaea873670c15651b4caec6662ded3cc8e597cb7e2b1eac67c7L109-R146)
*
[`.github/scripts/update_mod_versions.py`](diffhunk://#diff-ce76f7bf74b62aaea873670c15651b4caec6662ded3cc8e597cb7e2b1eac67c7L109-R146):
Modified `process_mods` function to determine the version source based
on the download URL, and updated the function signature to include a
start timestamp parameter.
*
[`.github/scripts/update_mod_versions.py`](diffhunk://#diff-ce76f7bf74b62aaea873670c15651b4caec6662ded3cc8e597cb7e2b1eac67c7L166-R198):
Updated the `generate_commit_message` function to include a start
timestamp for better logging.
### Workflow and environment updates:
*
[`.github/workflows/update-mod-versions.yml`](diffhunk://#diff-08c6175ddce4a9d49c79d12925be3c4f705913aadcd437a10b8bde3bde8fe740R29-R30):
Added `GITHUB_TOKEN` environment variable to the workflow for
authenticated API requests.
### Mod version updates:
* Updated the `version` field in `meta.json` files for multiple mods to
reflect the latest commit hashes:
* `mods/Agoraaa@FlushHotkeys/meta.json`
* `mods/Aure@SixSuits/meta.json`
* `mods/BataBata3@PampaPack/meta.json`
* `mods/Betmma@BetmmaMods/meta.json`
* `mods/Coo29@Yippie/meta.json`
* `mods/DarkAutumn2618@PlanetNine/meta.json`
* `mods/DigitalDetective47@CustomSuitOrder/meta.json`
* `mods/DigitalDetective47@NextAntePreview/meta.json`
* `mods/DigitalDetective47@StrangeLibrary/meta.json`
* `mods/DigitalDetective47@StrangePencil/meta.json`
* `mods/EnderGoodra@Textile/meta.json`
* `mods/Eremel@Galdur/meta.json`
* `mods/Eremel@Malverk/meta.json`
* `mods/GauntletGames-2086@D6Jokers/meta.json`
* `mods/GitNether@Paperback/meta.json`
* `mods/HuyTheKiller@SauKhongHuDecks/meta.json`
* `mods/HuyTheKiller@VietnameseBalatro/meta.json`
* `mods/InertSteak@Pokermon/meta.json`
Currently, the mod index will prioritise using the name of the tag from
the latest release version, regardless of the download source provided
by the mod. This is problematic for mods using a link to HEAD
(`archive/refs/heads/<main>.zip`) as their `downloadURL` but that also
have previously created a Release. This PR instead checks if the mod
links to HEAD, and uses the corresponding version.
Also included are improvements to error logging and wait time checks
when the GitHub REST API rate limits are hit, which appears to be
happening with inconsistent frequency. Hopefully these improvements will
help to narrow down the cause of the rate limit problems.
- Check if download url links to latest head, and if so, use version of
latest commit hash instead of release version
- Merge `get_latest_release` and `get_latest_commit` into
`get_version_string` for less duplicate code
- Check and print GitHub API rate limit details given by REST response
including api resource, remaining calls, and reset time
- On exceeding rate limit or 403 error, check if primary or secondary
rate limit has been reached
- On primary rate limit breach, wait until hourly rate reset time
- On secondary rate limit breach, wait for `retry-after` response time
or an exponential time, starting at 60 seconds and doubling for each
attempt (following requirements from GitHub API docs)
- Prevent program waiting for more than 30 minutes for API rate reset
time
- Check if download url links to latest head, and if so, use version of latest commit hash instead of release version
- Merge `get_latest_release` and `get_latest_commit` into `get_version_string` for less duplicate code
- Check and print GitHub API rate limit details including api resource, remaining calls, and reset time
- On exceeding rate limit or 403 error, check if primary or secondary rate limit has been reached
- On primary rate limit breach, wait until hourly rate reset time
- On secondary rate limit breach, wait for `retry-after` response time or an exponential time, starting at 60 seconds and doubling for each attempt, following GitHub API docs
- Prevent program waiting for more than 30 minutes for API rate reset time