Class IssueReportUrl

java.lang.Object
megamek.common.util.IssueReportUrl

public final class IssueReportUrl extends Object
Builds a GitHub issue-form URL with the reporter's environment details already filled in.

The suite's bug report template asks for the MegaMek version, operating system and Java version, all of them required, and instructs the player to find them by opening megamek.log in a text editor and reading its header. MegaMek already knows all three, so this class puts them into the form's URL and spares the player the transcription.

MegaMek, MegaMekLab and MekHQ all use GitHub issue forms whose field ids are identical, so a single query string serves all three and only the repository differs. The field ids below are a contract with .github/ISSUE_TEMPLATE/bug_report.yml in each of those repositories: if a field id is renamed there, the corresponding field here silently stops being filled in, without any error.

The labels query parameter is deliberately never set. GitHub requires the visitor to hold permission for any action a query parameter performs, and serves a 404 page when they do not. Since ordinary players have no triage permission on the suite's repositories, adding a labels parameter would replace the issue form with a 404 for exactly the people this feature exists to help, while continuing to work for every maintainer who tested it. Labelling belongs to the issue template, which applies its labels for every reporter regardless of permission.

See Also:
  • Field Details

  • Method Details

    • forIssueForm

      public static String forIssueForm(String repositoryIssuesUrl)
      Builds a prefilled issue-form URL for one of the repositories that uses the suite bug report template.

      If the URL would exceed MAX_URL_LENGTH the link is returned exactly as it was given, with no prefilled fields. A truncated URL is never produced, since that would land the player on a 404.

      Parameters:
      repositoryIssuesUrl - the repository's issue link, in either the /issues/new/choose or /issues/new form
      Returns:
      a URL that opens the issue form with the environment fields populated