Skip to content

Post duplicate annotations when run action again #58

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

Closed
shenxianpeng opened this issue Apr 26, 2022 · 7 comments
Closed

Post duplicate annotations when run action again #58

shenxianpeng opened this issue Apr 26, 2022 · 7 comments

Comments

@shenxianpeng
Copy link
Collaborator

shenxianpeng commented Apr 26, 2022

I noticed when the same actions run again, the annotations also are posted again. @2bndy5 If possible not send duplicate annotations?

The test example is here: https://github.com/shenxianpeng/test-cpp-linter-action/pull/17/files

@2bndy5
Copy link
Collaborator

2bndy5 commented Apr 26, 2022

I noticed this too when testing all the supported version of clang-tools with a workflow matrix. We're not actually using the REST API to make annotations, rather we're using github workflow log commands.

We could remove duplicate annotations if we use the REST API, but it isn't exactly the same as removing duplicate thread comments. I'm not sure if we can sneak in a HTML comment like we do for thread comments. If I recall correctly, the annotations' author is the workflow run count (or something similar), not a generic constant bot ID number. As far as I know, there isn't a workflow log command that allows removing annotations.

I'm not too concerned about duplicate annotations because why would anyone run the same action more than once on the same file(s)? Can you think of a use case for this (other than our own development purposes)?

@2bndy5
Copy link
Collaborator

2bndy5 commented Apr 26, 2022

We could throw in an option to disable annotations like the thread-comments option. This seems more viable

@shenxianpeng
Copy link
Collaborator Author

Can you think of a use case for this (other than our own development purposes)?

I used the default configuration as follows. when I push, it will add annotations, when I create PR, it will add annotations again.

on:
  push:
    paths-ignore: "docs/**"
  pull_request:
    paths-ignore: "docs/**"

@shenxianpeng
Copy link
Collaborator Author

We could throw in an option to disable annotations like the thread-comments option. This seems more viable

Yes, it's good to support disabled annotations. I prefer to use annotations instead of comments, so it should be best if this problem could be solved.

@2bndy5
Copy link
Collaborator

2bndy5 commented Apr 27, 2022

oh, that could be solved by configuring the workflow to execute the action only when a PR is opened or synchronized (specifically not when closed).

on:
  pull_request:
    types: [opened, synchronize, reopened]  # default includes `closed` event

link to github docs

@2bndy5
Copy link
Collaborator

2bndy5 commented Apr 27, 2022

ok I'll add the option to disable the annotations; it should be rather easy.

@shenxianpeng
Copy link
Collaborator Author

Yes, if only one event is configured, that won't happen. so the example in README may also need to be updated.

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