slack-github-action icon indicating copy to clipboard operation
slack-github-action copied to clipboard

Updating threads in multiple channels doesn't work correctly

Open dbasilio opened this issue 1 year ago • 7 comments

Description

#118 introduced the ability to post a message to multiple channels, but we're having issues with updating the threads in multiple channels afterwards. When calling the action you can put multiple channel IDs and and those get posted to correctly. However, the output from the action does not include the channel and thread id for each channel, only the last one to respond.

I'm happy to fix this bug, but want to confirm what the resulting output should be since the change is likely going to be breaking.

What type of issue is this? (place an x in one of the [ ])

  • [x] bug
  • [x] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] example code related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

The issue stems from here it's always overwriting the webResponse variable, so then when you get to the output section it only holds a reference to a single channel and thread id instead of all of them.

In order to fix this, you may need to change the shape of the output (which would be a breaking change). I'd suggest the following structure:

{
    "threads": [
        { "ts": "...", "thread_ts": "...", "channel_id": "..." },
        { "ts": "...", "thread_ts": "...", "channel_id": "..." }
    ]
}

An alternative would be to return a comma-separate list in each of ts, thread_ts, and channel_id, but I think it's safer to do an array to make sure the right thread_ts and channel_id are kept together.

Steps to reproduce:

  1. Call the action with multiple channels
  2. Store the output from the action in a workflow for use later
  3. View the output and see that only a single channel was output.

Expected result:

The output from the action includes the channel and thread ids for all the channels messaged.

Actual result:

The output from the action includes whichever channel/thread was the last to resolve from the API.

Attachments:

Logs showing we called the action with multiple channel IDs image

Log showing the output from the output (stored in an env_var METADATA_JSON) image

dbasilio avatar Jul 21 '23 20:07 dbasilio