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

Slack notification not being sent on success #121

Open
SkylerWittman opened this issue Nov 24, 2023 · 3 comments
Open

Slack notification not being sent on success #121

SkylerWittman opened this issue Nov 24, 2023 · 3 comments
Assignees

Comments

@SkylerWittman
Copy link

Hey there,

I've got a custom action that the last step is to send a slack notification of our customer release. Here is the action in the GHA yml file:

    - name: Slack customer deployment notification
      uses: ravsamhq/notify-slack-action@v1
      # Skip this notification for dev deployments
      if: ${{ !contains('["foo", "bar", "baz"]', inputs.clientName) }}
      with:
        status: ${{ job.status }}
        notification_title: "{repo} has been deployed to a customer environment"
        message_format: "Environment: '${{ inputs.clientName }}' has been deployed with version: `${{ inputs.imageTag }}`"
        notify_when: "success"
        icon_success: ":white_check_mark:"

      env:
        SLACK_WEBHOOK_URL: ${{ inputs.clientDeploymentSlackUrl }}

And I'm seeing all of those values correctly in the action when it ran:

Run ravsamhq/notify-slack-action@v1
  with:
    status: success
    notification_title: ***repo*** has been deployed to a customer environment
    message_format: Environment: 'foo' has been deployed with version: `v1.2.3`
    notify_when: success
    icon_success: :white_check_mark:
    footer: <***run_url***|View Run> | Developed by <https://www.ravsam.in|RavSam>
    mention_users_when: success,failure,warnings
    mention_groups_when: success,failure,warnings
    icon_failure: :x:
    icon_warnings: :large_orange_diamond:
  env:
    ENVIRONMENT_NAME: foo
    TAG_OR_COMMIT: v1.2.3
    VERSION: v1.2.3
    # ...
    SLACK_WEBHOOK_URL: ***

Obviously the SLACK_WEBHOOK_URL comes from a secret so it's not shown in the action output.

Is something wrong with the way I have it setup? Is there a way to debug this effectively to figure out why it failed?

Thanks!

Copy link
Contributor

ravsam-bot bot commented Nov 24, 2023

Hello and welcome to RavSam 💜. Thanks for opening your first issue. I will assign one of our team members to take a look at the problem you have raised. Make sure to include as much information as possible to help our team diagnose the issue and solve it quickly.

If the problem is related to a security concern, then please delete this issue and send us an email at info@ravsam.in.

@ravgeetdhillon
Copy link
Member

I don't see a problem with your if condition. I have questions:

  • Are you sure that the if condition is working for you? I mean try to run the action two times, the first time, making the if condition "true" and second time making the if condition "false".
  • If the above works correctly for you, then next you need to check if your Slack webhook URL is correct.

Other than that, I can't see any problem with your config.

@SkylerWittman
Copy link
Author

Thank you @ravgeetdhillon. It's tricky to test because this flow only runs on release. I'll try debugging it as you said in the first bullet.
Cheers

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

No branches or pull requests

2 participants