numtide / action-cli

GitHub Actions without JavaScript
Apache License 2.0
19 stars 1 forks source link

post-comment with ID #7

Open zimbatm opened 4 years ago

zimbatm commented 4 years ago

https://twitter.com/timbertson/status/1245081280657514496?s=20

Cool! I'd love a variant which did add-or-update comment, so it doesn't add a new comment on every push to a long PR. Maybe using a cache key to store existing comment ID?


I don't see many locations aside from the comment itself to store the cache key. Maybe something like this?

action-cli post-comment --comment-id "my-id" "message"
<!-- my-id -->
message
Rizary commented 4 years ago

Maybe we can edit comment that already being posted? Like every time someone push into the existing PR, the comment will not be added twice but instead revise current comment.

zimbatm commented 4 years ago

yes that's the idea

timbertson commented 4 years ago

I was thinking you'd post a comment, then store the comment ID (as in, the github generated ID) with however actions/cache stores stuff. But the predetermined ID in a comment is much nicer, because failures don't affect it.

zimbatm commented 4 years ago

One thing to verify is if the default GITHUB_TOKEN has the permissions to read and update the comments

DrSensor commented 3 years ago

Or maybe store the id as git-notes 🤔

References:

zimbatm commented 3 years ago

Are they being displayed in the PR view? The main motivation was to allow posting formatting and linting issues on PRs.

DrSensor commented 3 years ago

No. It's hidden in the git ref object and can only be accessed via specific urls or explicitly fetch them via git fetch $remote refs/notes/$name:refs/notes/$name.

git clone will not automatically fetch the notes. So the .git folder will stay as it was (unless you fetch them) and the git history will stay clean (whatever you fetch them or not).

Currently, no GitHub UI or button to easily access it, just url.