Skip to content

Releases: slackapi/slack-github-action

Slack Send v2.0.0

14 Nov 21:30
485a9d4
Compare
Choose a tag to compare

YAML! And more API methods! With improved erroring! And more!

Sending data to Slack can now be done with the YAML format, and that data can be sent to [a Slack API method][methods] or technique of choice with the provided payload. And additional configurations can improve error handling or customize values between steps.

Breaking changes happen with this update and recommended migration strategies are detailed below. Adding this step to new workflows might prefer to follow the README instead 📚

What's changed

Both inputs of payload variables, techniques for sending the payload, additional configurations, and expected outputs were changed:

The following sections detail these changes with recommended changes for existing GitHub workflows using this step and certain features.

If something seems off after making these changes, please feel free to [open an issue][issues] for discussion! 👾

Sending variables

The source of variables remains the same, using one of the following inputs:

  • payload: Inputs written inline in your GitHub workflow file.
  • payload-file-path: Inputs gathered from a file.
  • No input: Uses the default event [context][event-context] with a [payload][event-payload] matching the GitHub event.

⚠️ Breaking changes

Only one payload input can be provided

This Action now exits with an error if both payload and payload-file-path are provided.

Prior to updating: Both options could be provided with payload being preferred.

Recommended change: Use either payload, payload-file-path, or neither, when providing inputs. But don't include both.

Only one technique to send can be provided

This Action now exits with an error if both method and webhook techniques are provided.

Prior to updating: Both techniques could be used to send the same payload.

Recommended change: Use either method or webhook to send data, but not both.

Variable replacements no longer happen by default

This Action now sends payload provided in a payload-file-path file exactly as is.

Prior to updating: Templatized variables in input files were replaced with the matching github or env variable:

{
  "channel": "${{ env.SLACK_CHANNEL_ID }}",
  "text": "A commit was made: ${{ github.sha }}"
}

Changing the above file into something like this before being sent:

{
  "channel": "C0123456789",
  "text": "A commit was made: 3982e204d2ae590e908dd1e279e63933da566c8c"
}

Recommended change: To continue replacing templated variables provided from the step env or default GitHub event [context][event-context] and [payload][event-payload], set the payload-templated variable to true.

Payload file path parsed option was removed

This Action removed the payload-file-path-parsed input option.

Prior to updating: This option, which defaulted to true, could be set to false to avoid replacing templatized variables in a provided payload-file-path file.

Recommended change: Remove this option if it's set to false or set the new payload-templated option to true to continue parsing the provided payload.

🎁 Enhancements

Payloads can now be written in YAML

This Action now supports writing payload or payload-file-path values with YAML!

Prior to updating: Values provided as payloads had to be JSON.

Recommended change: Optional. Format the input payload value as YAML to match the surrounding steps:

- name: Post to a Slack channel
  uses: slackapi/slack-github-action@v2.0.0
  with:
    method: chat.postMessage
    token: ${{ secrets.SLACK_BOT_TOKEN }}
    payload: |
      channel: ${{ secrets.SLACK_CHANNEL_ID }}
      text: "Greetings <@channel>!"

Payload can now be written in unwrapped JSON

This Action now supports writing payload with unwrapped JSON, where surrounding braces are removed.

Prior to updating: Values provided as payloads had to be JSON.

Recommended change: Optional. Remove the surrounding braces from an existing payload value:

- name: Post to a Slack channel
  uses: slackapi/slack-github-action@v2.0.0
  with:
    method: chat.postMessage
    token: ${{ secrets.SLACK_BOT_TOKEN }}
    payload: |
      "channel": "${{ secrets.SLACK_CHANNEL_ID }}",
      "text": "Greetings <@channel>!",

Sending techniques

The techniques for sending variables remains the same, using one of the following:

  • Technique 1: [Slack Workflow Builder][wfb]
  • Technique 2: [Slack API method][methods]
  • Technique 3: [Slack incoming webhook][incoming-webhook]

Changes for different technique might be different and are included in each of the following sections.

Technique 1: Slack Workflow Builder

⚠️ Breaking changes

The webhook type must be specified in webhook inputs

This Action now requires setting the webhook-type as a step input value.

Prior to updating: The webhook type could be omitted to send to Workflow Builder.

Recommended change: Set the webhook-type value to webhook-trigger, as shown in the example below.

Payload flattening no longer happens by default

This Action no longer flattens or stringifies payloads being sent to Workflow Builder by default.

Prior to updating: Payloads sent using a webhook trigger were flattened with a . delimiter and have values stringified before being sent.

Recommended change: If payload flattening is needed, use the payload-delimiter option. Inputs of Slack workflows should use an underscore _ as a delimiter to match expected inputs of Workflow Builder:

- name: Send GitHub Action data to a Slack workflow
  uses: slackapi/slack-github-action@v2.0.0
  with:
    payload-delimiter: "_"
    webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
    webhook-type: webhook-trigger

🎁 Enhancements

The webhook URL can be specified in webhook inputs

This Action can now set the webhook URL as a step input.

Prior to updating: The SLACK_WEBHOOK_URL environm...

Read more

Slack Send V1.27.1

14 Nov 20:30
fcfb566
Compare
Choose a tag to compare

What's changed

This release tags multiple updates to dependencies and a clarification in documentation 📚

No changes are needed to update from slackapi/slack-github-action@v1.27.0 - other than bumping the version - but ongoing development is now happening on version @v2 and @v1 is no longer planning to receive significant updates after this.

Please stay tuned for upcoming changes, and may all of your workflows run well ❤️

📚 Documentation

  • docs(fix): reference octokit context and github event webhook payloads in variables in #348 - thanks @zimeg!

🧪 Maintenance

  • ci: include the slack health score as part of ci tests in #346 - thanks @zimeg!

📦 Dependencies

  • build(deps): bump axios from 1.7.5 to 1.7.7 in #334 - thanks @dependabot!
  • build(deps-dev): bump mocha from 10.7.0 to 10.7.3 in #335 - thanks @dependabot!
  • build(deps-dev): bump eslint-plugin-jsdoc from 48.10.2 to 50.2.2 in #336 - thanks @dependabot!
  • build(deps): bump @slack/web-api from 7.3.4 to 7.5.0 in #339 - thanks @dependabot!
  • build(deps-dev): bump eslint-plugin-import from 2.29.1 to 2.30.0 in #341 - thanks @dependabot!
  • build(deps-dev): bump eslint-plugin-jsdoc from 50.2.2 to 50.3.1 in #344 - thanks @dependabot!
  • build(deps-dev): bump nyc from 17.0.0 to 17.1.0 in #342 - thanks @dependabot!
  • build(deps-dev): bump sinon from 18.0.0 to 19.0.2 in #343 - thanks @dependabot!
  • build(deps-dev): bump mocha from 10.7.3 to 10.8.2 in #350 - thanks @dependabot!
  • build(deps): bump @slack/web-api from 7.5.0 to 7.7.0 in #351 - thanks @dependabot!
  • build(deps-dev): bump eslint-plugin-import from 2.30.0 to 2.31.0 in #352 - thanks @dependabot!
  • build(deps-dev): bump eslint-plugin-jsdoc from 50.3.1 to 50.4.3 in #353 - thanks @dependabot!
  • build(deps): bump @actions/core from 1.10.1 to 1.11.1 in #354 - thanks @dependabot!
  • build(deps): bump codecov/codecov-action from 4.5.0 to 4.6.0 in #355 - thanks @dependabot!

Full Changelog: v1.27.0...v1.27.1

Slack Send v2.0.0-rc.3

12 Nov 17:08
71c4f79
Compare
Choose a tag to compare

What's changed

Here's a third take of the release candidate for slackapi/slack-github-action@v2 from the v2-development branch 🍁

The release includes numerous and significant breaking changes for all techniques, and for now we recommend reading the README.md to discover what's changed for the techniques you're using. A more detailed migration guide will soon follow! 📚

More details for those planning to experiment

A few improvements to error handling and outputs throughout this GitHub Action were included from findings in recent testing!

To use this GitHub step in a GitHub workflow, please check that you're using this release candidate:

  uses: slackapi/slack-github-action@v2.0.0-rc.3

Changes required to make existing workflows work are suggested in the README.md. But for those wanting a sneak peak, posting a message using a bot token is now done with patterns like so:

- name: Post to a Slack channel
  uses: slackapi/slack-github-action@v2.0.0-rc.3
  with:
    method: chat.postMessage
    token: ${{ secrets.SLACK_BOT_TOKEN }}
    payload: |
      channel: ${{ secrets.SLACK_CHANNEL_ID }}
      text: "howdy <@channel>!"

Sharing feedback

As development reaches more stable commits, your feedback and findings in these tagged changes is so important! Please feel free to report an issue or leave a comment if something doesn't seem right. We're hoping this rollout won't be a spooky one! ✨

Slack Send v2.0.0-rc.2

02 Nov 00:10
3f58188
Compare
Choose a tag to compare

What's changed

Here's take two for what's hoping to become slackapi/slack-github-action@v2 from the v2-development branch 🎬

The release includes numerous and significant breaking changes for all techniques, and for now we recommend reading the README.md to discover what's changed for the techniques you're using. A more detailed migration guide will soon follow! 📚

More details for those planning to experiment

A problem with the packaged and tagged release was fixed and this GitHub Action is in a more readied state for experimentation!

To use this GitHub step in a GitHub workflow, please check that you're using this release candidate:

  uses: slackapi/slack-github-action@v2.0.0-rc.2

Changes required to make existing workflows work are suggested in the README.md. But for those wanting a sneak peak, posting a message using a bot token is now done with patterns like so:

- name: Post to a Slack channel
  uses: slackapi/slack-github-action@v2.0.0-rc.2
  with:
    method: chat.postMessage
    token: ${{ secrets.SLACK_BOT_TOKEN }}
    payload: |
      channel: ${{ secrets.SLACK_CHANNEL_ID }}
      text: "howdy <@channel>!"

Sharing feedback

As development reaches more stable commits, your feedback and findings in these tagged changes is so important! Please feel free to report an issue or leave a comment if something doesn't seem right. We're hoping this rollout won't be a spooky one! ✨

Slack Send v2.0.0-rc.1

01 Nov 03:20
c2dfde8
Compare
Choose a tag to compare

What's changed

Seasons greeting! 🎃 This pre-release tags some of the ongoing changes on the v2-development branch for testing and experiments with actual workflows.

The release includes numerous and significant breaking changes for all techniques, and for now we recommend reading the README.md to discover what's changed for the techniques you're using. A more detailed migration guide will soon follow! 📚

⚠️ An issue has been found related to loading ES modules when using this GitHub Action. A following release candidate plans to address this soon!

Previewing a few of these changes

As a glance into how the different techniques function, the following snippets might be useful. With all of these changes, please note the version used in the GitHub step:

  uses: slackapi/slack-github-action@v2.0.0-rc.1

This is the same version that's required when experimenting with this pre-release!

Technique 1: Slack Workflow Builder

This technique uses a webhook trigger to start a Slack workflow in Workflow Builder:

- name: Send GitHub Action data to a Slack workflow
  uses: slackapi/slack-github-action@v2.0.0-rc.1
  with:
    payload-delimiter: "_"
    webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
    webhook-type: webhook-trigger

Technique 2: Slack API method

This technique uses a provided token and one of the Slack API methods to send data:

- name: Post to a Slack channel
  uses: slackapi/slack-github-action@v2.0.0-rc.1
  with:
    method: chat.postMessage
    token: ${{ secrets.SLACK_BOT_TOKEN }}
    payload: |
      channel: ${{ secrets.SLACK_CHANNEL_ID }}
      text: "howdy <@channel>!"

Technique 3: Slack incoming webhook

This technique posts a message to a channel using incoming webhooks:

- name: Post a message in a channel
  uses: slackapi/slack-github-action@v2.0.0-rc.1
  with:
    webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
    webhook-type: incoming-webhook
    payload: |
      text: "*GitHub Action build result*: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
      blocks:
        - type: "section"
          text:
            type: "mrkdwn"
            text: "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"

Sharing feedback

As development reaches more stable commits, your feedback and findings in these tagged changes is so important! Please feel free to report an issue or leave a comment if something doesn't seem right. We're hoping this rollout won't be a spooky one! 👻

Slack Send V1.27.0

28 Aug 20:00
37ebaef
Compare
Choose a tag to compare

What's changed

This release introduces an optional payload-delimiter parameter for flattening nested objects with a customized delimiter before the payload is sent to Slack Workflow Builder when using workflow webhook triggers.

  - name: Send a custom flattened payload
    uses: slackapi/slack-github-action@v1.27.0
+   with:
+     payload-delimiter: "_"
    env:
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

Setting this value to an underscore (_) is recommended when using nested inputs within Workflow Builder to match expected input formats of Workflow Builder, but the actual value can be changed to something else! This "flattening" behavior did exist prior to this version, but used a period (.) which is not valid for webook inputs in Workflow Builder.

Flattening example

The resulting output of flattened objects is not always clear, but the following can hopefully serve as a quick reference as well as these specs when using _ as the delimiter:

Input:

{
    "apples": "tree",
    "bananas": {
        "truthiness": true
    }
}

Output:

{
    "apples": "tree",
    "bananas_truthiness": "true"
}

Notice that bananas_truthiness is also stringified in this process, as part of updating values to match the expected inputs of Workflow Builder!

Changes

In addition to the changes above, the following lists all of the changes since the prior version with the complete changelog changes found here: v1.26.0...v1.27.0

🎁 Enhancements

  • Make payload delimiter configurable in #281 - thanks @rzumer!

📚 Documentation

🔒 Security

🧪 Maintenance

  • Add codecov coverage uploading in #308 - thanks @filmaj!
  • ci(test): run integration tests in a single sequential environment in #310 - thanks @zimeg!

📦 Dependencies

  • Bump eslint-plugin-jsdoc from 48.2.2 to 48.2.3 in #305 - thanks @dependabot!
  • Bump @slack/web-api from 7.0.2 to 7.0.4 in #307 - thanks @dependabot!
  • build(deps-dev): bump sinon from 17.0.1 to 18.0.0 in #313 - thanks @dependabot!
  • build(deps-dev): bump eslint-plugin-jsdoc from 48.2.3 to 48.2.7 in #314 - thanks @dependabot!
  • build(deps): bump axios from 1.6.8 to 1.7.2 in #315 - thanks @dependabot!
  • build(deps): bump codecov/codecov-action from 4.0.1 to 4.4.1 in #316 - thanks @dependabot!
  • build(deps-dev): bump nyc from 15.1.0 to 17.0.0 in #319 - thanks @dependabot!
  • build(deps-dev): bump eslint-plugin-jsdoc from 48.2.7 to 48.5.0 in #321 - thanks @dependabot!
  • build(deps-dev): bump mocha from 10.4.0 to 10.5.2 in #322 - thanks @dependabot!
  • build(deps): bump codecov/codecov-action from 4.4.1 to 4.5.0 in #324 - thanks @dependabot!
  • build(deps): bump @slack/web-api from 7.0.4 to 7.2.0 in #323 - thanks @dependabot!
  • build(deps): bump https-proxy-agent from 7.0.4 to 7.0.5 in #320 - thanks @dependabot!
  • build(deps-dev): bump eslint-plugin-jsdoc from 48.5.0 to 48.10.2 in #325 - thanks @dependabot!
  • build(deps-dev): bump chai from 4.4.1 to 4.5.0 in #326 - thanks @dependabot!
  • build(deps): bump @slack/web-api from 7.2.0 to 7.3.2 in #327 - thanks @dependabot!
  • build(deps-dev): bump mocha from 10.5.2 to 10.7.0 in #328 - thanks @dependabot!

🎉 New contributors

Slack Send V1.26.0

19 Apr 00:52
70cd7be
Compare
Choose a tag to compare

What's Changed

This release provides an escape hatch for sending the JSON content of a payload file exactly as is, without replacing any templated variables!

Previously a payload file was parsed and templated variables were replaced with values from github.context and github.env. Any undefined variables were replaced with ??? in this process, which might have caused questions.

That remains the default behavior, but now the JSON contents of a payload file can be sent exactly as written by setting the payload-file-path-parsed input to false:

- name: Send custom JSON data to Slack workflow
  id: slack
  uses: slackapi/slack-github-action@v1.26.0
  with:
    payload-file-path: "./payload-slack-content.json"
    payload-file-path-parsed: false
  env:
    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

With this change, the contents of the example payload-slack-content.json will be sent to a webhook URL exactly as is!

Recent commits

Enhancements

  • allow to use json file as is without replacing/parsing anything by @talgendler in #299

Documentation

  • docs(readme): adjust whitespace in env assignment by @paulo9mv in #296

Maintenance

  • ci(test): collect environment secrets from a prepared staging environment by @zimeg in #294
  • ci(test): share environment secrets with pull requests from forked prs by @zimeg in #297

Dependencies

New Contributors

Full Changelog: v1.25.0...v1.26.0

Slack Send V1.25.0

26 Jan 21:54
6c661ce
Compare
Choose a tag to compare

What's Changed

  • Update payload integration test to escape invalid characters by @hello-ashleyintech in #207
  • #204: Handle proxies when using Slack WebClient by @raihle in #205
  • README: clarify limitations to workflow builder approach by @ryan-williams in #228
  • Add instructions for developing with a local version of the action by @zimeg in #250
  • Pass secrets to approved workflow jobs by @zimeg in #258
  • build(node): bump the runtime version to node 20 by @zimeg in #267
  • ci(security): require access checks to pass before running unit tests by @zimeg in #279
  • ci(security): check for pull_request_target events in the access check by @zimeg in #282

New Contributors

Full Changelog: v1.24.0...v1.25.0

Slack Send V1.24.0

17 May 21:31
e28cf16
Compare
Choose a tag to compare

What's Changed

  • Add in testing instructions for maintainer's guide and standardize bullet point punctuation by @hello-ashleyintech in #140
  • Added checks for bot token and webhook url length by @koki-develop in #124
  • Add channel_id output parameter by @maso7 in #149
  • [#171] Update Technique 2 to use Actions context instead of values property by @mwbrooks in #172
  • Fix interpolation of variables in file-based payloads by @filmaj in #200
  • Update README.md with variable usage and links to example workflows by @filmaj in #201

New Contributors

Full Changelog: v1.23.0...v1.24.0

Slack Send V1.23.0

12 Oct 15:14
007b2c3
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.22.0...v1.23.0