Skip to content

Commit

Permalink
Merge remote-tracking branch 'hannibal002/beta' into backend/debug-livid
Browse files Browse the repository at this point in the history
  • Loading branch information
martimavocado committed Nov 25, 2024
2 parents 8da7ee1 + 7600c77 commit 75e3882
Show file tree
Hide file tree
Showing 399 changed files with 6,227 additions and 4,386 deletions.
26 changes: 8 additions & 18 deletions .github/workflows/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
detekt:
name: Run detekt
runs-on: ubuntu-latest
concurrency:
group: detekt-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
Expand All @@ -40,7 +43,7 @@ jobs:
fi
- name: Add label if detekt fails
if: failure()
if: ${{ failure() && steps.check_sarif.outputs.exists == 'true' }}
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -67,6 +70,9 @@ jobs:
detekt_comment:
name: Comment detekt failures on PR
runs-on: ubuntu-latest
concurrency:
group: detekt-comment-${{ github.event.pull_request.number }}
cancel-in-progress: true
needs: detekt
if: ${{ needs.detekt.outputs.sarif_exists == 'true' && failure() }}
permissions:
Expand All @@ -92,24 +98,8 @@ jobs:
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
node .github/scripts/process_detekt_output.js
- name: Check if this is the latest workflow run
id: check_latest
run: |
PR_LATEST_SHA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" \
| jq -r '.head.sha')
echo "Latest commit SHA from PR: $PR_LATEST_SHA"
echo "Current workflow SHA: ${{ github.event.pull_request.head.sha }}"
# Compare the SHAs and set a result variable
if [[ "${PR_LATEST_SHA}" == "${{ github.event.pull_request.head.sha }}" ]]; then
echo "is_latest=true" >> $GITHUB_ENV
else
echo "is_latest=false" >> $GITHUB_ENV
fi
- name: Add comment to PR
if: env.is_latest == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
24 changes: 4 additions & 20 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:
verify-changelog:
if: github.event.pull_request.state == 'open' && '511310721' == github.repository_id && github.event.pull_request.draft == false
runs-on: ubuntu-latest

concurrency:
group: verify-changelog-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -42,26 +44,8 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'Wrong Title/Changelog'

- name: Check if this is the latest workflow run
if: failure()
id: check_latest
run: |
PR_LATEST_SHA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" \
| jq -r '.head.sha')
echo "Latest commit SHA from PR: $PR_LATEST_SHA"
echo "Current workflow SHA: ${{ github.event.pull_request.head.sha }}"
# Compare the SHAs and set a result variable
if [[ "${PR_LATEST_SHA}" == "${{ github.event.pull_request.head.sha }}" ]]; then
echo "is_latest=true" >> $GITHUB_ENV
else
echo "is_latest=false" >> $GITHUB_ENV
fi
- name: Add comment to PR if changelog verification fails
if: ${{ failure() && env.is_latest == 'true' }}
if: failure()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .live-plugins/regexr/plugin.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ val logger =
Logger.getInstance("SkyHanni")

val regexTestPrefix = "REGEX-TEST: "
val regexTestFailPrefix = "REGEX-FAIL: "

class RegexInfo(
val regex: KtValueArgument,
Expand Down Expand Up @@ -50,7 +51,7 @@ class RegexInfo(
}

fun getExamples(): List<String> {
val examples = commentText?.filter { it.startsWith(regexTestPrefix) }
val examples = commentText?.filter { it.startsWith(regexTestPrefix) || it.startsWith(regexTestFailPrefix) }
?.map { it.substring(regexTestPrefix.length) }
if (examples == null) return listOf()
return examples
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ format like "- #821" to illustrate the dependency.
- **There are valid reasons to deviate from the norm**
- If you have such a case, either use `@Supress("rule_name")`, or re-build the `baseline.xml` file, using `./gradlew detektBaselineMain`.
After running detektBaselineMain, you should find a file called `baseline-main.xml` in the `version/1.8.9` folder, rename the file to
`baseline.xml` replacing the old one. You also should copy the new contents of this file to the [main baseline file](detekt/baseline.xml)
`baseline.xml` replacing the old one.
- Do not copy features from other mods. Exceptions:
- Mods that are paid to use.
- Mods that have reached their end of life. (Rip SBA, Dulkir and Soopy).
Expand Down Expand Up @@ -145,6 +145,7 @@ format like "- #821" to illustrate the dependency.
- Do not use `MinecraftForge.EVENT_BUS.post(event)`, use `event.post()` instead.
- Do not use `toRegex()` or `toPattern()`, use `RepoPattern` instead.
- See [RepoPattern.kt](https://github.com/hannibal002/SkyHanni/blob/beta/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt)
- All repo patterns must be accompanied by a regex test. Look at other patterns for examples.
for more information and usages.
- The pattern variables are named in the scheme `variableNamePattern`
- Please use Regex instead of String comparison when it is likely Hypixel will change the message in the future.
Expand Down
6 changes: 2 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ tasks.withType<Detekt>().configureEach {
onlyIf {
target == ProjectTarget.MAIN && project.findProperty("skipDetekt") != "true"
}
jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
outputs.cacheIf { false } // Custom rules won't work if cached

reports {
html.required.set(true) // observe findings in your browser with structure and code snippets
Expand All @@ -432,10 +434,6 @@ tasks.withType<Detekt>().configureEach {
}
}

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
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ repositories {

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("com.github.SkyHanniStudios:SkyHanniChangelogBuilder:1.0.1")
implementation("com.github.SkyHanniStudios:SkyHanniChangelogBuilder:1.0.2")
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract class ChangelogVerification : DefaultTask() {

@TaskAction
fun scanChangelog() {
if (prBodyLines.contains("exclude_from_changelog")) {
if (prBodyLines.let { it.contains("exclude_from_changelog") || it.contains("ignore_from_changelog") }) {
println("PR is excluded from changelog verification")
return
}
Expand Down
Loading

0 comments on commit 75e3882

Please sign in to comment.