= GitHub Discussions

Posts a message to link:https://docs.github.com/en/discussions[GitHub Discussions]. You must provide a GitHub token with
the `write:discussion` scope enabled. Will use the same token set in xref:configuration:release/github.adoc[].

include::partial$legend.adoc[]

[tabs]
====
YAML::
+
[source,yaml]
[subs="+macros"]
----
announce:
  # icon:dot-circle[]
  discussions:

    # Enable or disable this announcer.
    # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
    # Defaults to `NEVER`.
    # icon:dot-circle[]
    active: ALWAYS

    # Defines the connection timeout in seconds.
    # Defaults to `20`.
    # icon:dot-circle[]
    connectTimeout: 20

    # Defines the read timeout in seconds.
    # Defaults to `60`.
    # icon:dot-circle[]
    readTimeout: 60

    # The GitHub organization that owns the discussion.
    # icon:exclamation-triangle[]
    organization: some-org

    # The GitHub team that owns the discussion.
    # icon:exclamation-triangle[]
    team: some-team

    # The messages' title.
    # Review the available xref:configuration:name-templates.adoc[].
    # icon:dot-circle[] icon:file-alt[]
    title: {{projectNameCapitalized}} {{projectVersion}} released!

    # The announcement message.
    # Review the available xref:configuration:name-templates.adoc[].
    # icon:dot-circle[] icon:file-alt[]
    message: icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}

    # Path to a template file that contains the message.
    # Review the available xref:configuration:name-templates.adoc[].
    # Defaults to `src/jreleaser/templates/discussions.tpl`.
    # icon:dot-circle[]
    messageTemplate: path/to/template/discussions.tpl
----
TOML::
+
[source,toml]
[subs="+macros"]
----
# icon:dot-circle[]
[announce.discussions]

  # Enable or disable this announcer.
  # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `NEVER`.
  # icon:dot-circle[]
  active = "ALWAYS"

  # Defines the connection timeout in seconds.
  # Defaults to `20`.
  # icon:dot-circle[]
  connectTimeout = 20

  # Defines the read timeout in seconds.
  # Defaults to `60`.
  # icon:dot-circle[]
  readTimeout = 60

  # The GitHub organization that owns the discussion.
  # icon:exclamation-triangle[]
  organization = "some-org"

  # The GitHub team that owns the discussion.
  # icon:exclamation-triangle[]
  team = "some-team"

  # The messages' title.
  # Review the available xref:configuration:name-templates.adoc[].
  # icon:dot-circle[] icon:file-alt[]
  title = "{{projectNameCapitalized}} {{projectVersion}} released!"

  # The announcement message.
  # Review the available xref:configuration:name-templates.adoc[].
  # icon:dot-circle[] icon:file-alt[]
  message = "icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}"

  # Path to a template file that contains the message.
  # Review the available xref:configuration:name-templates.adoc[].
  # Defaults to `src/jreleaser/templates/discussions.tpl`.
  # icon:dot-circle[]
  messageTemplate = "path/to/template/discussions.tpl"
----
JSON::
+
[source,json]
[subs="+macros"]
----
{
  "announce": {
    // icon:dot-circle[]
    "discussions": {

      // Enable or disable this announcer.
      // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      // icon:dot-circle[]
      "active": "ALWAYS",

      // Defines the connection timeout in seconds.
      // Defaults to `20`.
      // icon:dot-circle[]
      "connectTimeout": 20,

      // Defines the read timeout in seconds.
      // Defaults to `60`.
      // icon:dot-circle[]
      "readTimeout": 60,

      // The GitHub organization that owns the discussion.
      // icon:exclamation-triangle[]
      "organization": "some-org",

      // The GitHub team that owns the discussion.
      // icon:exclamation-triangle[]
      "team": "some-team",

      // The messages' title.
      // Review the available xref:configuration:name-templates.adoc[].
      // icon:dot-circle[] icon:file-alt[]
      "title": "{{projectNameCapitalized}} {{projectVersion}} released!",

      // The announcement message.
      // Review the available xref:configuration:name-templates.adoc[].
      // icon:dot-circle[] icon:file-alt[]
      "message": "icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}",

      // Path to a template file that contains the message.
      // Review the available xref:configuration:name-templates.adoc[].
      // Defaults to `src/jreleaser/templates/discussions.tpl`.
      // icon:dot-circle[]
      "messageTemplate": "path/to/template/discussions.tpl"
    }
  }
}
----
Maven::
+
[source,xml]
[subs="+macros,verbatim"]
----
<jreleaser>
  <announce>
    <!--
      icon:dot-circle[]
    -->
    <discussions>

      <!--
        Enable or disable this announcer.
        Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        Defaults to `NEVER`.
        icon:dot-circle[]
      -->
      <active>ALWAYS</active>

      <!--
        Defines the connection timeout in seconds.
        Defaults to `20`.
        icon:dot-circle[]
      -->
      <connectTimeout>20</connectTimeout>

      <!--
        Defines the read timeout in seconds.
        Defaults to `60`.
        icon:dot-circle[]
      -->
      <readTimeout>60</readTimeout>

      <!--
        The GitHub organization that owns the discussion.
        icon:exclamation-triangle[]
      -->
      <organization>some-org</organization>

      <!--
        The GitHub team that owns the discussion.
        icon:exclamation-triangle[]
      -->
      <team>some-team</team>

      <!--
        The messages' title.
        Review the available xref:configuration:name-templates.adoc[].
        icon:dot-circle[] icon:file-alt[]
      -->
      <title>{{projectNameCapitalized}} {{projectVersion}} released!</title>

      <!--
        The announcement message.
        Review the available xref:configuration:name-templates.adoc[].
        icon:dot-circle[] icon:file-alt[]
      -->
      <message>icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}</message>

      <!--
        Path to a template file that contains the message.
        Review the available xref:configuration:name-templates.adoc[].
        Defaults to `src/jreleaser/templates/discussions.tpl`.
        icon:dot-circle[]
      -->
      <messageTemplate>path/to/template/discussions.tpl</messageTemplate>
    </discussions>
  </announce>
</jreleaser>
----
Gradle::
+
[source,groovy]
[subs="+macros"]
----
jreleaser {
  announce {
    // icon:dot-circle[]
    discussions {

      // Enable or disable this announcer.
      // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      // icon:dot-circle[]
      active = 'ALWAYS'

      // Defines the connection timeout in seconds.
      // Defaults to `20`.
      // icon:dot-circle[]
      connectTimeout = 20

      // Defines the read timeout in seconds.
      // Defaults to `60`.
      // icon:dot-circle[]
      readTimeout = 60

      // The GitHub organization that owns the discussion.
      // icon:exclamation-triangle[]
      organization = 'some-org'

      // The GitHub team that owns the discussion.
      // icon:exclamation-triangle[]
      team = 'some-team'

      // The messages' title.
      // Review the available xref:configuration:name-templates.adoc[].
      // icon:dot-circle[] icon:file-alt[]
      title = '{{projectNameCapitalized}} {{projectVersion}} released!'

      // The announcement message.
      // Review the available xref:configuration:name-templates.adoc[].
      // icon:dot-circle[] icon:file-alt[]
      message = 'icon:rocket[] {{projectNameCapitalized}} {{projectVersion}} has been released! {{releaseNotesUrl}}'

      // Path to a template file that contains the message.
      // Review the available xref:configuration:name-templates.adoc[].
      // Defaults to `src/jreleaser/templates/discussions.tpl`.
      // icon:dot-circle[]
      messageTemplate = 'path/to/template/discussions.tpl'
    }
  }
}
----
====

You may define either `message` or `messageTemplate`, with the former taking precedence over the latter.

The template file may be initialized using the `template` command.
