Repository navigation
Add --edit-last-or-create option or enhance the functionality of --edit-last for PR comments #6790
Description
Activity
- changed the title
[-]Add --edit-last-if-exists option or enhance the functionality of --edit-last for PR comments[/-][+]Add --edit-last-or-create option or enhance the functionality of --edit-last for PR comments[/+]on Dec 27, 2022 I'm wondering if there is harm in just having --edit-last just make a comment if no previous comment exists? we could output a warning, like:
gh issue comment 123 --edit-last -b "hmmm" ! Warning: no previous comment :checkmark: added commentAdding the discuss label for our next sync meeting.
Reacted by Dima Rozhdestvenskiy, Stephen Lewis Bianamara, Slesa Adhikari and Tatyana Rodionova- addeddiscussFeature changes that require discussion primarily among the GitHub CLI teamFeature changes that require discussion primarily among the GitHub CLI team
on Jan 3, 2023 I was kinda leaning to just asking for that but decided I wanted to be open to other options. IMO the expected behavior would be to have it just work, but the warning is nice too. Maybe a config option could be added to change the warning to an error?
Reacted by Stephen Lewis BianamaraActually, does this feature help your use case? https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/
Another option is to do something like this in your script:
body="foobar" gh issue comment 123 --edit-last "$body" || gh issue comment 123 "$body"If neither build summaries or this scripting approach works for you, we can talk about adding a new flag. There is internal resistance to making
--edit-lastan upsert action.Reacted by ralph- addedmore-info-neededMore info needed from user/contributorMore info needed from user/contributorand removeddiscussFeature changes that require discussion primarily among the GitHub CLI teamFeature changes that require discussion primarily among the GitHub CLI team
on Jan 9, 2023 The feature you pointed out won't work for us because we use other CI providers mostly. We did end up doing something similar to your last comment. I would think an extra flag would be useful and completely understand the pushback to modifying the existing flag.
I would appreciate if we had another flag which can enable upsert action to satisfy any resistance.
Reacted by Joe Sharp@vilmibm sorry for the ping. Just wanted to get this back on your radar.
- Reacted by Joe Sharp
@vilmibm I am still on the fence but I won't stand in the way of this feature getting implemented.
Reacted by Joe SharpI am glad there was resistance on making the existing action an upsert action because now we actually rely on that due to a feature change in the script. Anyways, just wanted to update to say we are no longer blocked by this feature request but maybe someday having a
--upsertaction might be nice.- addedcoreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributorsand removedmore-info-neededMore info needed from user/contributorMore info needed from user/contributor
on Jun 23, 2023 I'm interested in this feature. Will work on this.
Reacted by Joe SharpWould love for one of the proposals on this issue to go through - any one of them would work nicely with my current ci/cd setup.
Describe the feature or problem you’d like to solve
Currently running
gh pr comment --edit-lastwill fail if there is not an existing comment from the author. It would be nice to prompt users and/or allow users to use the option (or a new option) that will edit the last comment if it it exists but creates a new one if not.Proposed solution
Add an additional option for
gh pr commentsuch as--edit-last-or-createthat will not fail if the user hasn't yet commented on the PR, it will simply create a new comment.How will it benefit CLI and its users?
Script writers will no longer need to worry about making a conditional to check if a comment exists before running the command. This is useful for commenting the results of a build or linting job without polluting the PR with multiple comments.
Additional context
Please let me know if additional context is needed, but this should be pretty straight forward.