Skip to content

successCommentCondition not able to check PR labels #920

Closed
@shahzebrizvi16

Description

@shahzebrizvi16

I am trying to limit the success comments to only PRs which have not been released on a specific channel already. I am doing this by setting the successCommentCondition to check if a PR has the respective "released on @<channel>" label already or not. If it does then success commenting should be skipped.

In a nutshell, I am trying to avoid this on PRs:

image

I tried doing it the way specified in the README.md file but after testing it I realized that it might be incorrect. This is because within the Pull Request GitHub API response, the "labels" key is an array of objects which is why the loadash method -.includes would not work there.

So instead I tried to set the successCommentCondition this way using the loadash method -.some after locally testing with a sample API response:

    [
      "@semantic-release/github",
      {
        successCommentCondition:
          "<% return !issue.labels?.some((label) => { return label.name === ('released on @beta'); }) %>"
      }
    ],

The snippet above still did not work. My PRs with the label released on @beta are still getting commented on if I back-merge the main branch tags to the beta branch.

Can I please get some guidance on this, is it my syntax or is this potentially a bug with the plugin?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions