Skip to content

[Feature] Ability to specify a comment should NOT be created if its tag does not yet exist #169

@btrautmann

Description

@btrautmann

I have a workflow that checks the codebase for the existence of some token, and then checks a file within the codebase for a baseline of that token. In some cases, the token is removed but the baseline remains, and we want to notify PR authors that they can remove the baseline. We do this with a comment:

      - name: Comment on PR
        uses: thollander/actions-comment-pull-request@c22fb302208b7b170d252a61a505d2ea27245eff #v2.0.0
        if: ${{ steps.check_for_useless_baselines.outputs.useless_baselines == 'true' }}
        with:
          message: Violations exist <tag>
          comment_tag: <tag>

I would love to be able to tell the author that they have resolved all the issues, which would be based on the following conditional in a separate step that looks much like the one above:

if: ${{ steps.check_for_useless_baselines.outputs.useless_baselines == 'false' }}

However, I don't want to post this comment unless the first one has been posted (i.e unless the author had previous violations in a past commit), and since my workflow can't know the state of previous runs, I feel it would need to be something like:

      - name: Comment on PR
        uses: thollander/actions-comment-pull-request@c22fb302208b7b170d252a61a505d2ea27245eff #v2.0.0
        if: ${{ steps.check_for_useless_baselines.outputs.useless_baselines == 'false' }}
        with:
          message: Violations fixed <tag>
          comment_tag: <tag>
          create_if_not_exists: false # defaults to true

The end result, when violations existed, would be:

  1. Comment indicating violations exist
  2. Comment indicating violations were resolved

The end result, when no violations existed, would be that no comments are posted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions