Conditions: executing a step based on the last build

Now my notification step is only executed if the build has failed. I would like to be able to perform this step even when the bug is fixed.
There is a way to perform a step based on the state of the last build performed on the same branch?

example:

  • build number: n, branch: feature_x, status: red --> send notification
  • build number: n+1, branch: feature_y, status: green --> do nothing
  • build number: n+2, branch: feature_x, status: green --> send notification
  • build number: n+3, branch: feature_x, status: green --> do nothing