title: How can I know the Jenkins Build Status
body: <p>Im actually doing my own Jenkins plugin, and I have a class that extends from <code>RunListener&lt;Run&gt;</code>, with the next <code>onCompleted()</code> method:</p>
  
  <pre><code>@Override
  public void onCompleted(Run build, TaskListener listener) {
      int number = build.number;
      EnvVars env;
      String name = "";
      try {
          env = build.getEnvironment(listener);
          name = env.get("JOB_NAME") + "-" + env.get("BUILD_NUMBER");
      } catch (IOException | InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      GraphicAction act = new GraphicAction(name);
      build.getActions().add((Action) act);
  }
  </code></pre>
  
  <p>Is there any posibility of executing the last 2 lines only if the build has been successful?</p>
  
  <p>Thanks!</p>