Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sometimes payloads are sent to the wrong channel #317

Open
6 tasks
ipavlov314 opened this issue Jun 3, 2024 · 4 comments
Open
6 tasks

sometimes payloads are sent to the wrong channel #317

ipavlov314 opened this issue Jun 3, 2024 · 4 comments
Labels
question Further information is requested

Comments

@ipavlov314
Copy link

ipavlov314 commented Jun 3, 2024

Description

I see that sometimes payloads are sent to the wrong channel.

I have channels for pr-notifications and nightly-notifications, with two separate workflows for PRs and Nightly builds. Somehow, PR payloads with results are sent to nightly-notifications. Some days it happens more, some days less.

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

  • [ x] bug
  • 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

Reproducible in:

package version: 70cd7be # v1.2.6

node version:

OS version(s): Mac 14.2.1 (23C71)

Steps to reproduce:

  1. Not clear how to reproduce

Expected result:

Payload should be send only to provided channels

Actual result:

I see that sometimes payloads are sent to the wrong channel.

Attachments:

Set up I have

// action file with inputs 
slack_auth:
    required: false
    default: ""
  slack_channel:
    required: false
    default: "Please provide a Slack channel ID."
    
    - name: Send UITests results to Slack
      id: slack
      uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.2.6
      if: success() || failure()
      with:
        payload-file-path: "myPath\payload.json"
        channel-id: ${{ inputs.slack_channel }}
      env:
        SLACK_BOT_TOKEN: ${{ inputs.slack_auth }} 
        
 // from workflow for Nightly I have 
 
 .....
       
        slack_auth: ${{ env.SLACK_ACCESS_TOKEN }}
        slack_channel: ${{ env.NIGHTLY_NOTIFICATIONS }}

// Channels ID stored in secretes as variables 

Also public channel ids are pretty different

@WilliamBergamin WilliamBergamin added the question Further information is requested label Jun 3, 2024
@WilliamBergamin
Copy link
Contributor

WilliamBergamin commented Jun 3, 2024

Hi @ipavlov314 thanks for writing in 💯

I'm not sure how the this action may be posting to the wrong channel 🤔
From what you provided it seem like the default channel value comes from an environment variable and gets overwritten when an input value is provided, have you tried echoing the value of ${{ inputs.slack_channel }} before executing the the post message step?

This action is stateless, it does not save what channels it has posted to in the past

@ipavlov314
Copy link
Author

Thanks for quick response.
In logs for action I see it set to right channel

Run slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e
  with:
    payload-file-path: my.json
    channel-id: XXXXX // added to mack channel id
    payload-file-path-parsed: true

However payload was send to the other one, any possible redirection regarding firewall or any other infrastructure settings you my think?

@WilliamBergamin
Copy link
Contributor

Have you tried printing out the channel_id output value returned from the step and ensuring it is the same one sent as an input?

I've looked at the source code there does not seem to be any logic that may change the channel-id value, I am also unable to reproduce this behavior

@zimeg
Copy link
Member

zimeg commented Jun 4, 2024

I'm also a bit confused here, but can the payload-file-path content contain a top-level channel attribute different from the channel-id in the action? That might override the channel-id provided as an input parameter if so 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants