How to Get the User Who Changed Workflow State?

Hello everyone,

I would like to ask:
When a document moves from one Workflow State to another (for example, from “Saved” to “Printed”), how can I capture the user who triggered that workflow change?

Specifically, I want to record or access the user who performed the action when the Workflow State was updated.

Is there a recommended way to do this inside a server script, a custom method, or a workflow action hook?
Any advice or best practices would be greatly appreciated!

Thank you!