Can slack orb use multiple `only_for_branch` strings

Hello,

i am using the slack/slack@1.0.4 orb. i am trying to use the only_for_branch parameter, and feed it multiple branches like this

- slack/status:
    fail_only: 'true'
    #mentions: 'USERID1,USERID2'
    only_for_branch: |
      hotfix
      master
      defect/fix-ci-build
    webhook: ${SLACK_WEBHOOK}

However the above doesn’t work and i can only get it to work with a single string like:

    only_for_branch: defect/fix-ci-build 

is there a way to define multiple strings for the only_for_branch parameter?

Mats

@mathews Currently, that parameter is doing an exact check under the hood, so only designed to accept a single branch value:

    only_for_branch:
      description: If set, a specific branch for which slack status updates will be sent.
      type: string
      default: ""

That said, it should be pretty easy to modify it to do some kind of expanded check that would allow folks to pass either multiple exact branch names, or a regular expression pattern, etc.—feel free to take a shot at a PR.

Or, if that feels overburdensome/out-of-reach, you’re welcome to just file an issue against the repository and we can pull it onto our bugs/enhancements board for prioritization.

I’m sure you’re not the only one who would benefit from this functionality!

it looks like slack-orb: clir/slack-orb@0.0.6 already has this logic.
Thanks i will use this orb

Oh, awesome, great find! @mathews

That code is super simple, we’ll just borrow it and add it to our first-party Slack orb :slightly_smiling_face:

@mathews Now available (along with a lot of other features not included in clir/slack) in circleci/slack@3.2.0 :slightly_smiling_face:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.