Hello Xin Li,
I believe that the complexity of your question may vary according to the complexity of your application because Action B may be in a different module, or even in a different application inside your environment.
Maybe the best way to make this possible and easy, is to create an input variable in Action B. Then, when you call it from anywhere you like, you shall pass the name of the calling Action. In this case, "ActionA". There, you can do whatever you want with it, knowing that the Input Value will show you who is calling.
I hope it helps. Cheers,
Rúben