Mr. Jenkins reacts to the build result. After the build, he appears in the side panel of the build page and of the job page (where he shows the mood of the last completed build that used this action).

Build resultMood
Successhappy
Unstableworried
Failureangry
Aborted or not builtdisappointed

The mood follows the final result of the build, so it is right even when the action runs before the build has finished. It needs no agent or workspace.

In a Pipeline, use the emotionalJenkins() step. In a Declarative Pipeline, put it in post { always { emotionalJenkins() } } so it runs whatever the outcome; in a Scripted Pipeline, call it in a finally block at the end.