Skip to content

Commit

Permalink
Merge branch 'beta' into feature/election-viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
j10a1n15 authored Oct 12, 2024
2 parents 7699b27 + 015352c commit 5d462dd
Show file tree
Hide file tree
Showing 329 changed files with 4,525 additions and 2,184 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/assign-relevant-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "Assign relevant labels"
on:
pull_request_target:
types: [ opened, edited ]
jobs:
assign-label:
if: github.event.pull_request.state == 'open'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: read
steps:
- name: label
env:
TITLE: ${{ github.event.pull_request.title }}
LABEL_FIX: Bug Fix
LABEL_BACKEND: Backend
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN}}
script: |
const labelsToAdd = [];
const labelsToRemove = [];
const title = process.env.TITLE.split(":")[0].toUpperCase();
if(title.includes("FIX")){
labelsToAdd.push(process.env.LABEL_FIX);
} else {
labelsToRemove.push(process.env.LABEL_FIX);
}
if(title.includes("BACKEND")){
labelsToAdd.push(process.env.LABEL_BACKEND);
} else {
labelsToRemove.push(process.env.LABEL_BACKEND);
}
for (const label of labelsToAdd) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [label]
});
}
const {data} = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
for (const label of labelsToRemove) {
const filtered = data.filter(l => l.name == label);
if(filtered.length == 1){
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: label
});
}
}
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
- uses: ./.github/actions/setup-normal-workspace
- name: Build with Gradle
run: ./gradlew assemble -x test --stacktrace
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Upload development build
with:
name: "Development Build"
path: build/libs/*.jar
- name: Test with Gradle
run: ./gradlew test
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: "Upload test report"
if: ${{ !cancelled() }}
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/generate-constants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Generate Repo Patterns using Gradle
run: |
./gradlew generateRepoPatterns --stacktrace
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Upload generated repo regexes
with:
name: Repo Regexes
Expand All @@ -45,7 +45,7 @@ jobs:
with:
repository: ${{ env.data_repo }}
branch: main
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: Upload generated repo regexes
with:
name: Repo Regexes
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/label-bug-fix.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "PR Changelog Verification"

on:
pull_request_target:
types: [ opened, edited ]

jobs:
verify-changelog:
if: github.event.pull_request.state == 'open' && '511310721' == github.repository_id
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: ./.github/actions/setup-normal-workspace

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run ChangeLog verification
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: |
./gradlew checkPrDescription -PprTitle="${PR_TITLE}" -PprBody="${PR_BODY}"
- name: Add label if changelog verification fails
if: failure()
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'Wrong Title/Changelog'

- name: Remove label if changelog verification passes
if: success()
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'Wrong Title/Changelog'

- name: Add comment to PR if changelog verification fails
if: failure()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const test = fs.readFileSync('versions/1.8.9/build/changelog_errors.txt', 'utf8');
const commentBody = `${test}`
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
})
4 changes: 4 additions & 0 deletions .idea/dictionaries/default_user.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 45 additions & 28 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import at.skyhanni.sharedvariables.MultiVersionStage
import at.skyhanni.sharedvariables.ProjectTarget
import at.skyhanni.sharedvariables.SHVersionInfo
import at.skyhanni.sharedvariables.versionString
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import net.fabricmc.loom.task.RunGameTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import skyhannibuildsystem.ChangelogVerification

plugins {
idea
Expand Down Expand Up @@ -100,6 +103,13 @@ tasks.runClient {
},
)
}

tasks.register("checkPrDescription", ChangelogVerification::class) {
this.outputDirectory.set(layout.buildDirectory)
this.prTitle = project.findProperty("prTitle") as String
this.prBody = project.findProperty("prBody") as String
}

val shot = shots.shot("minecraft", rootProject.file("shots.txt"))

dependencies {
Expand Down Expand Up @@ -148,9 +158,9 @@ dependencies {
exclude(module = "unspecified")
isTransitive = false
}
// August 27, 2024, 4:30 PM AEST
// https://github.com/NotEnoughUpdates/NotEnoughUpdates/tree/2.3.3
devenvMod("com.github.NotEnoughUpdates:NotEnoughUpdates:2.3.3:all") {
// October 3, 2024, 11:43 PM AEST
// https://github.com/NotEnoughUpdates/NotEnoughUpdates/tree/2.4.0
devenvMod("com.github.NotEnoughUpdates:NotEnoughUpdates:2.4.0:all") {
exclude(module = "unspecified")
isTransitive = false
}
Expand All @@ -171,6 +181,9 @@ dependencies {

implementation("net.hypixel:mod-api:0.3.1")

// getting clock offset
shadowImpl("commons-net:commons-net:3.8.0")

detektPlugins("org.notenoughupdates:detektrules:1.0.0")
detektPlugins(project(":detekt"))
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7")
Expand Down Expand Up @@ -279,6 +292,7 @@ tasks.shadowJar {
relocate("io.github.notenoughupdates.moulconfig", "at.hannibal2.skyhanni.deps.moulconfig")
relocate("moe.nea.libautoupdate", "at.hannibal2.skyhanni.deps.libautoupdate")
relocate("com.jagrosh.discordipc", "at.hannibal2.skyhanni.deps.discordipc")
relocate("org.apache.commons.net", "at.hannibal2.skyhanni.deps.commons.net")
}
tasks.jar {
archiveClassifier.set("nodeps")
Expand Down Expand Up @@ -344,28 +358,31 @@ publishing.publications {
}
}

// Detekt: TODO: Uncomment this when we're ready to enforce
// detekt {
// buildUponDefaultConfig = true // preconfigure defaults
// config.setFrom(rootProject.layout.projectDirectory.file("detekt/detekt.yml")) // point to your custom config defining rules to run, overwriting default behavior
// baseline = file(layout.projectDirectory.file("detekt/baseline.xml")) // a way of suppressing issues before introducing detekt
// source.setFrom(project.sourceSets.named("main").map { it.allSource })
// }
//
// tasks.withType<Detekt>().configureEach {
// reports {
// html.required.set(true) // observe findings in your browser with structure and code snippets
// xml.required.set(true) // checkstyle like format mainly for integrations like Jenkins
// sarif.required.set(true) // standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with GitHub Code Scanning
// md.required.set(true) // simple Markdown format
// }
// }
//
// tasks.withType<Detekt>().configureEach {
// jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
// outputs.cacheIf { false } // Custom rules won't work if cached
// }
// tasks.withType<DetektCreateBaselineTask>().configureEach {
// jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
// outputs.cacheIf { false } // Custom rules won't work if cached
// }
detekt {
buildUponDefaultConfig = true // preconfigure defaults
config.setFrom(rootProject.layout.projectDirectory.file("detekt/detekt.yml")) // point to your custom config defining rules to run, overwriting default behavior
baseline = file(layout.projectDirectory.file("detekt/baseline.xml")) // a way of suppressing issues before introducing detekt
source.setFrom(project.sourceSets.named("main").map { it.allSource })
}

tasks.withType<Detekt>().configureEach {
onlyIf {
false // TODO: Remove onlyIf when we're ready to enforce
}

reports {
html.required.set(true) // observe findings in your browser with structure and code snippets
xml.required.set(true) // checkstyle like format mainly for integrations like Jenkins
sarif.required.set(true) // standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with GitHub Code Scanning
md.required.set(true) // simple Markdown format
}
}

tasks.withType<Detekt>().configureEach {
jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
outputs.cacheIf { false } // Custom rules won't work if cached
}
tasks.withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
outputs.cacheIf { false } // Custom rules won't work if cached
}
17 changes: 17 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
maven("https://jitpack.io") {
content {
includeGroupByRegex("com\\.github\\..*")
}
}
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("com.github.SkyHanniStudios:SkyHanniChangelogBuilder:1.0.1")
}
Loading

0 comments on commit 5d462dd

Please sign in to comment.