aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternDump.kt
blob: 6cacb9a5354de97517df38fb4a9877b0f38a0f41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package at.hannibal2.skyhanni.utils.repopatterns

import at.hannibal2.skyhanni.utils.KSerializable

/**
 * A class containing a dump of all regexes that are defined using [RepoPattern].
 *
 * # Generating a dump
 * This dump is generated by the `.github/workflows/generate-constants.yaml` using the gradle task `generateRepoPatterns`.
 * Said gradle task then launches Minecraft headless with environment variables set so that [RepoPatternManager.onPreInitFinished]
 * calls [RepoPatternManager.dump] and closes afterward. The GitHub action then looks at the current branch and repo,
 * and if it finds itself to be running on hannibal002/SkyHanni:beta, it commits that generated dump to the SkyHanni REPO.
 *
 * # Using the dump
 * All clients upon launching will then look at that dump generated by the latest beta version, even if they themselves
 * run an older SkyHanni version. The regexes generated by the dump will then take precedence over the ones found in the
 * running JAR.
 *
 * # Setting up the `generate-constants.yaml` workflow
 * The GitHub action workflow needs to be configured properly. For that it needs to have the
 * `env.data_repo` key adjusted to be the live repo.
 * It also needs a [repository GitHub action secret](https://github.com/nea89o/SkyHanni/settings/secrets/actions)
 * called `REPO_PAT`, which contains a [personal access token](https://github.com/settings/tokens/new) with repo write
 * access to the live repo.
 */
@KSerializable
data class RepoPatternDump(
    val sourceLabel: String = "anonymous",
    val regexes: Map<String, String> = mapOf(),
)