Listen for Git push events from IntelliJ plugin Follow
I'm currently working on an IntelliJ plugin that, among many others, should have a feature for creating PRs after a successful push. For this, I have to react to the push event and take appropriate action. So far, I was only able to find out how to listen to commits using a CheckInHandler - is there something similar for pushes that would allow me to implement what I'm trying to do?
Please sign in to leave a comment.
Please try GitPushProcessCustomization#executeAfterPush(). You'll have to check the push results, whether they are successful or not.
Ah, you're right: it is not that straightforward there. If a customization is defined, it is in some cases executed instead of the base code. See the GitPushOperation class. So you might need to provide some duplication of the base code inside of yours for runPushCommand (your implementation above is correct) and for executeAfterPushIteration() as well (although if you're going to support only single-repository projects, this should work as is).
Moreover, the code assumes that there is no more than one customization, otherwise they are all disabled. However, I'm not aware of any available implementations of it, apart from one our plugin that we use internally.
That said, it should work, but you should be aware of potential issues, until we provide an API to notify about the push result.
Thanks a lot. Just to be sure my code doesn't break any other possible Git integrations, is this the correct way to only use GitPushProcessCustomization#executeAfterPush() without re-implementing all the other methods in the interface?
Great, thanks! This question can be marked as solved then.
GitPushProcessCustomization#executeAfterPush() has been deleted,what to do ?
201900301184 seems the question is discussed in the another topic https://intellij-support.jetbrains.com/hc/en-us/community/posts/5738949204242-How-to-listen-a-git-push-event-in-a-plugin