Skip to content

Guard OctoMC Maven credentials to unblock CodeQL Java/Kotlin autobuild#102

Merged
Chinay-Domitrix merged 2 commits into
developmentfrom
copilot/fix-analyze-java-kotlin-job
Jun 6, 2026
Merged

Guard OctoMC Maven credentials to unblock CodeQL Java/Kotlin autobuild#102
Chinay-Domitrix merged 2 commits into
developmentfrom
copilot/fix-analyze-java-kotlin-job

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

Analyze (java-kotlin) failed in GitHub Actions because Gradle configuration hard-cast missing octomcUsername / octomcPassword properties, causing null cannot be cast to non-null type kotlin.String before autobuild could run. This PR makes credential wiring conditional so CI can configure/build without private repo secrets.

  • Root cause addressed

    • Replaced unsafe property casts with nullable lookups in Gradle Kotlin DSL where OctoMC repo credentials are configured.
  • Build script hardening

    • Updated buildSrc convention plugin:
      • buildSrc/src/main/kotlin/net.octopvp.java-conventions.gradle.kts
    • Updated module build scripts:
      • OctoCore-1.21/build.gradle.kts
      • OctoCore-1.8/build.gradle.kts
      • OctoCore-common/build.gradle.kts
      • OctoCore-Core/build.gradle.kts (including publishing repository credentials block)
  • Behavior change

    • Credentials are applied only when both properties are present; otherwise repository declarations remain unauthenticated and do not fail configuration.
val octomcUsername = findProperty("octomcUsername") as String?
val octomcPassword = findProperty("octomcPassword") as String?

maven {
    url = uri("https://repo.octopvp.net/repo")
    name = "octomc"
    if (octomcUsername != null && octomcPassword != null) {
        credentials {
            username = octomcUsername
            password = octomcPassword
        }
    }
}

Copilot AI changed the title [WIP] Fix failing GitHub Actions job 'Analyze (java-kotlin)' Guard OctoMC Maven credentials to unblock CodeQL Java/Kotlin autobuild Jun 5, 2026
Copilot AI requested a review from Chinay-Domitrix June 5, 2026 14:18
@Chinay-Domitrix Chinay-Domitrix requested a review from Copilot June 5, 2026 14:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Gradle Kotlin DSL credential wiring for the OctoMC Maven repository so CI workflows (notably GitHub Actions CodeQL Java/Kotlin autobuild) don’t fail during Gradle configuration when octomcUsername / octomcPassword properties are absent.

Changes:

  • Replaced non-null casts of findProperty("octomcUsername"/"octomcPassword") with nullable lookups.
  • Applied credentials to the OctoMC Maven repository only when both username and password are present.
  • Extended the conditional credential behavior to the publishing repository configuration in OctoCore-Core.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
OctoCore-Core/build.gradle.kts Makes OctoMC repo + publishing credentials conditional on both properties being present.
OctoCore-common/build.gradle.kts Guards OctoMC repository credentials behind a null check to avoid config-time crashes.
OctoCore-1.8/build.gradle.kts Guards OctoMC repository credentials behind a null check to avoid config-time crashes.
OctoCore-1.21/build.gradle.kts Guards OctoMC repository credentials behind a null check to avoid config-time crashes.
buildSrc/src/main/kotlin/net.octopvp.java-conventions.gradle.kts Updates the conventions plugin repository credentials block to be conditional.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Chinay-Domitrix Chinay-Domitrix marked this pull request as ready for review June 5, 2026 15:05
@Chinay-Domitrix Chinay-Domitrix merged commit f480ef2 into development Jun 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants