How to run an action when clicking on an appindicator

An app indicator can only open its menu. It can't perform any other action and your program doesn't get notified when the menu is displayed.

You could either include some kind of "Update" menu item or find other events that trigger the update.