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

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

Closed
btrautmann opened this issue Dec 14, 2022 · 3 comments · Fixed by #173
Closed

Comments

@btrautmann
Copy link

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.

thollander added a commit that referenced this issue Dec 18, 2022
thollander added a commit that referenced this issue Dec 18, 2022
@thollander
Copy link
Owner

Released in v2.3.0

@btrautmann
Copy link
Author

This happened so fast I missed it! Thanks @thollander, will give it a shot!

@btrautmann
Copy link
Author

Update: This worked perfectly :) Thanks again!

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

Successfully merging a pull request may close this issue.

2 participants