Skip to content

Commit

Permalink
conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
superhize committed Oct 17, 2024
2 parents 7511374 + f4fa81e commit 4846986
Show file tree
Hide file tree
Showing 402 changed files with 6,428 additions and 2,920 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: 3 additions & 1 deletion .idea/dictionaries/default_user.xml

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

7 changes: 7 additions & 0 deletions .live-plugins/module/plugin.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ val forgeEvent = "SubscribeEvent"
val handleEvent = "HandleEvent"
val skyHanniModule = "SkyHanniModule"

val skyhanniPath = "at.hannibal2.skyhanni"
val patternGroup = "at.hannibal2.skyhanni.utils.repopatterns.RepoPatternGroup"
val pattern = "java.util.regex.Pattern"

Expand All @@ -36,12 +37,17 @@ fun isRepoPattern(property: KtProperty): Boolean {
return false
}

fun isFromSkyhanni(declaration: KtNamedDeclaration): Boolean {
return declaration.fqName?.asString()?.startsWith(skyhanniPath) ?: false
}

class ModuleInspectionKotlin : AbstractKotlinInspection() {
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {

val visitor = object : KtVisitorVoid() {

override fun visitClass(klass: KtClass) {
if (!isFromSkyhanni(klass)) return
val hasAnnotation = klass.annotationEntries.any { it.shortName?.asString() == skyHanniModule }

if (hasAnnotation) {
Expand All @@ -54,6 +60,7 @@ class ModuleInspectionKotlin : AbstractKotlinInspection() {
}

override fun visitObjectDeclaration(declaration: KtObjectDeclaration) {
if (!isFromSkyhanni(declaration)) return
val hasAnnotation = declaration.annotationEntries.any { it.shortName?.asString() == skyHanniModule }
if (hasAnnotation) return

Expand Down
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ out [their guide](https://github.com/NotEnoughUpdates/NotEnoughUpdates/blob/mast

If you are not very familiar with git, you might want to try this out: https://learngitbranching.js.org/.

_An explanation how to use intellij and branches will follow here soon._
Proposed changes are better off being in their own branch, you can do this by doing the following from within IntelliJ with the SkyHanni project already open.
- Click the beta dropdown at the top of IntelliJ
- Click new branch
- Give the branch a name relating to the changes you plan to make

_A more in depth explanation how to use intellij and branches will follow here soon._

Please use a prefix for the name of the PR (E.g. Feature, Improvement, Fix, Backend, ...).

Expand Down
16 changes: 16 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ 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
import skyhannibuildsystem.DownloadBackupRepo

plugins {
idea
Expand Down Expand Up @@ -95,13 +97,26 @@ val headlessLwjgl by configurations.creating {
isTransitive = false
isVisible = false
}

val includeBackupRepo by tasks.registering(DownloadBackupRepo::class) {
this.outputDirectory.set(layout.buildDirectory.dir("downloadedRepo"))
this.branch = "main"
}

tasks.runClient {
this.javaLauncher.set(
javaToolchains.launcherFor {
languageVersion.set(target.minecraftVersion.javaLanguageVersion)
},
)
}

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 @@ -205,6 +220,7 @@ kotlin {

// Tasks:
tasks.processResources {
from(includeBackupRepo)
inputs.property("version", version)
filesMatching(listOf("mcmod.info", "fabric.mod.json")) {
expand("version" to version)
Expand Down
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 4846986

Please sign in to comment.