While it is currently possible to define customized actions they have only limited use as they cannot access any of the GUI elements. To pass information about the GUI to the actions environment variables can be used.
The attached patch add support for adding environment variables to the whole stack of classes that are involved in executing the actions. Additionally it sets two environment variables CURRENT_PATCH and PATCHES which refer to the patch SHAs selected in the GUI.
The patch is against the QT3 qgit repository.
As further improvements more vars could be added - especially filtered list of patches - as only already/not yet applied patches and so on.