// Path: github-pullrequest-plugin/src/main/java/org/jenkinsci/plugins/github/pullrequest/utils/JobHelper.java
// @CheckForNull
// public static GitHubPRCause ghPRCauseFromRun(Run<?, ?> run) {
//     return ghCauseFromRun(run, GitHubPRCause.class);
// }
// 
// Path: github-pullrequest-plugin/src/main/java/org/jenkinsci/plugins/github/pullrequest/utils/JobHelper.java
// @CheckForNull
// public static GitHubPRTrigger ghPRTriggerFromRun(Run<?, ?> run) {
//     return triggerFrom(run.getParent(), GitHubPRTrigger.class);
// }


import hudson.Extension;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.model.listeners.RunListener;
import hudson.plugins.git.util.BuildData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.umd.cs.findbugs.annotations.NonNull;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static org.jenkinsci.plugins.github.pullrequest.utils.JobHelper.ghPRCauseFromRun;
import static org.jenkinsci.plugins.github.pullrequest.utils.JobHelper.ghPRTriggerFromRun;
package org.jenkinsci.plugins.github.pullrequest;




/**
 * Sets Pending build status before build run and manipulates Git's BuildData attached to job Action.
 *
 * @author Kanstantsin Shautsou
 */
@Extension
public class GitHubPRBuildListener extends RunListener<Run<?, ?>> {
    private static final Logger LOGGER = LoggerFactory.getLogger(GitHubPRBuildListener.class);

    @Override
    public void onCompleted(Run<?, ?> run, @NonNull TaskListener listener) {
        GitHubPRTrigger trigger = ghPRTriggerFromRun(run);
        if (isNull(trigger)) {
// Path: github-pullrequest-plugin/src/main/java/org/jenkinsci/plugins/github/pullrequest/utils/JobHelper.java
// @CheckForNull
// public static GitHubPRCause ghPRCauseFromRun(Run<?, ?> run) {
//     return ghCauseFromRun(run, GitHubPRCause.class);
// }
// 
// Path: github-pullrequest-plugin/src/main/java/org/jenkinsci/plugins/github/pullrequest/utils/JobHelper.java
// @CheckForNull
// public static GitHubPRTrigger ghPRTriggerFromRun(Run<?, ?> run) {
//     return triggerFrom(run.getParent(), GitHubPRTrigger.class);
// }


// Path: github-pullrequest-plugin/src/main/java/org/jenkinsci/plugins/github/pullrequest/GitHubPRBuildListener.java
import hudson.Extension;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.model.listeners.RunListener;
import hudson.plugins.git.util.BuildData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.umd.cs.findbugs.annotations.NonNull;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static org.jenkinsci.plugins.github.pullrequest.utils.JobHelper.ghPRCauseFromRun;
import static org.jenkinsci.plugins.github.pullrequest.utils.JobHelper.ghPRTriggerFromRun;

package org.jenkinsci.plugins.github.pullrequest;




/**
 * Sets Pending build status before build run and manipulates Git's BuildData attached to job Action.
 *
 * @author Kanstantsin Shautsou
 */
@Extension
public class GitHubPRBuildListener extends RunListener<Run<?, ?>> {
    private static final Logger LOGGER = LoggerFactory.getLogger(GitHubPRBuildListener.class);

    @Override
    public void onCompleted(Run<?, ?> run, @NonNull TaskListener listener) {
        GitHubPRTrigger trigger = ghPRTriggerFromRun(run);
        if (isNull(trigger)) {
            return;