How to check the name of the step of the job that ...
# ask-ai
j
How to check the name of the step of the job that has been run in a hook ?
s
To check the name of the step of the job that has been run in a hook, you can access the
step_key
property from the
HookContext
. The
step_key
is the key for the step where the hook is being triggered. Here's how you can access it within a hook:
Copy code
python @hook def my_hook(context):     step_key = context.step_key     # You can now use the step_key for your logic
This
step_key
will give you the identifier for the specific step within the job that the hook is responding to.