Skip to main content

Slack

Send release notifications to Slack

Config

announce:
  slack:
    enabled: true
    webhook_url: "{{ Env.SLACK_WEBHOOK }}"
    message_template: "{{ ProjectName }} {{ Tag }} released: {{ ReleaseURL }}"

When webhook_url is unset, anodizer falls back to the SLACK_WEBHOOK env var.

FieldTypeDescription
enabledbool or templateEnable Slack notifications
webhook_urlstringSlack webhook URL (falls back to SLACK_WEBHOOK)
message_templatestringMessage body (templates supported). Default: {{ ProjectName }} {{ Tag }} is out! Check it out at {{ ReleaseURL }}
channelstringOverride the webhook's default channel (#releases)
usernamestringUsername the post arrives under. Default: anodizer
icon_emojistringOverride the webhook's default icon with an emoji (:rocket:)
icon_urlstringOverride the webhook's default icon with an image URL
blockslistSlack Block Kit blocks; every string in them is a template
attachmentslistSlack legacy attachments; every string in them is a template

Blocks and attachments

announce:
  slack:
    webhook_url: "{{ Env.SLACK_WEBHOOK }}"
    message_template: "{{ ProjectName }} {{ Tag }} is out"
    blocks:
      - type: header
        text:
          type: plain_text
          text: '{{ ProjectName }} {{ Tag }} "stable"'
      - type: section
        text:
          type: mrkdwn
          text: "{{ ReleaseNotes }}"
    attachments:
      - color: "#36a64f"
        title: "{{ Tag }}"
        text: "{{ ReleaseURL }}"

Each string is rendered on its own, so a literal quote in a block's text and the newlines a {{ ReleaseNotes }} body produces reach Slack as written. message_template is the fallback text Slack shows where blocks cannot be rendered. Block-specific fields (accessory, elements, fields, …) are passed through unchanged, and dist/config.yaml records them as written.

A string that fails to render stops the run before any publisher fires, and the error names its JSON path below the field, for example render announce.slack.blocks[1].text.text, so the broken leaf is found without bisecting the list.

anodizer check config reads the same tree: every string in blocks and attachments, the block-specific fields included, is checked for a secret-named {{ Env.* }} reference, and a warning names the leaf by the same path (announce.slack.attachments[0].fields[0].value). Outbound redaction masks such a value before it reaches Slack; see Notification secret redaction.

anodizer check config