// Path: github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/multibranch/head/GitHubBranchSCMHead.java
// public class GitHubBranchSCMHead extends GitHubSCMHead<GitHubBranchCause> {
//     private static final long serialVersionUID = 1L;
// 
//     public GitHubBranchSCMHead(@NonNull String name, String sourceId) {
//         super(name, sourceId);
//     }
// 
//     @Override
//     public String getPronoun() {
//         return "Branch " + getName();
//     }
// 
//     @Override
//     public String fetchHeadSha(GHRepository remoteRepo) throws IOException {
//         GHBranch branch = remoteRepo.getBranch(getName());
//         if (branch == null) {
//             throw new IOException("No branch " + getName() + " in " + remoteRepo.getFullName());
//         }
//         return branch.getSHA1();
//     }
// 
//     @Override
//     public String getHeadSha(GitHubBranchCause cause) {
//         return cause.getCommitSha();
//     }
// }
// 
// Path: github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/multibranch/head/GitHubSCMHead.java
// public abstract class GitHubSCMHead<T extends GitHubCause<T>> extends SCMHead {
//     private static final long serialVersionUID = 1L;
// 
//     private final String sourceId;
// 
//     public GitHubSCMHead(@NonNull String name, String sourceId) {
//         super(name);
//         this.sourceId = sourceId;
//     }
// 
//     public String getSourceId() {
//         return sourceId;
//     }
// 
//     public abstract String fetchHeadSha(GHRepository remoteRepo) throws IOException;
// 
//     public abstract String getHeadSha(T cause);
// 
//     public GitHubSCMRevision createSCMRevision(T cause) {
//         return new GitHubSCMRevision(this, getHeadSha(cause), cause);
//     }
// }


import com.github.kostyasha.github.integration.branch.data.GitHubBranchEnv;
import com.github.kostyasha.github.integration.multibranch.head.GitHubBranchSCMHead;
import com.github.kostyasha.github.integration.multibranch.head.GitHubSCMHead;
import hudson.model.ParameterValue;
import hudson.model.Run;
import jenkins.scm.api.SCMSourceOwner;
import org.kohsuke.github.GHBranch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.IOException;
import java.util.List;
import static org.apache.commons.io.FileUtils.writeStringToFile;
        this(remoteBranch.getName(), remoteBranch.getSHA1());
        withReason(reason);
        withSkip(skip);
        withLocalRepo(localRepo);
        withRemoteData(remoteBranch);
    }

    public GitHubBranchCause(@NonNull String branchName, String commitSha) {
        super(commitSha, "refs/heads/" + branchName);
        this.branchName = branchName;
    }

    /**
     * Copy constructor
     */
    public GitHubBranchCause(GitHubBranchCause cause) {
        super(cause);
        this.branchName = cause.getBranchName();
    }

    public String getBranchName() {
        return branchName;
    }

    @Override
    public void fillParameters(List<ParameterValue> params) {
        GitHubBranchEnv.getParams(this, params);
    }

    @Override
// Path: github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/multibranch/head/GitHubBranchSCMHead.java
// public class GitHubBranchSCMHead extends GitHubSCMHead<GitHubBranchCause> {
//     private static final long serialVersionUID = 1L;
// 
//     public GitHubBranchSCMHead(@NonNull String name, String sourceId) {
//         super(name, sourceId);
//     }
// 
//     @Override
//     public String getPronoun() {
//         return "Branch " + getName();
//     }
// 
//     @Override
//     public String fetchHeadSha(GHRepository remoteRepo) throws IOException {
//         GHBranch branch = remoteRepo.getBranch(getName());
//         if (branch == null) {
//             throw new IOException("No branch " + getName() + " in " + remoteRepo.getFullName());
//         }
//         return branch.getSHA1();
//     }
// 
//     @Override
//     public String getHeadSha(GitHubBranchCause cause) {
//         return cause.getCommitSha();
//     }
// }
// 
// Path: github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/multibranch/head/GitHubSCMHead.java
// public abstract class GitHubSCMHead<T extends GitHubCause<T>> extends SCMHead {
//     private static final long serialVersionUID = 1L;
// 
//     private final String sourceId;
// 
//     public GitHubSCMHead(@NonNull String name, String sourceId) {
//         super(name);
//         this.sourceId = sourceId;
//     }
// 
//     public String getSourceId() {
//         return sourceId;
//     }
// 
//     public abstract String fetchHeadSha(GHRepository remoteRepo) throws IOException;
// 
//     public abstract String getHeadSha(T cause);
// 
//     public GitHubSCMRevision createSCMRevision(T cause) {
//         return new GitHubSCMRevision(this, getHeadSha(cause), cause);
//     }
// }


// Path: github-pullrequest-plugin/src/main/java/com/github/kostyasha/github/integration/branch/GitHubBranchCause.java
import com.github.kostyasha.github.integration.branch.data.GitHubBranchEnv;
import com.github.kostyasha.github.integration.multibranch.head.GitHubBranchSCMHead;
import com.github.kostyasha.github.integration.multibranch.head.GitHubSCMHead;
import hudson.model.ParameterValue;
import hudson.model.Run;
import jenkins.scm.api.SCMSourceOwner;
import org.kohsuke.github.GHBranch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.IOException;
import java.util.List;
import static org.apache.commons.io.FileUtils.writeStringToFile;

        this(remoteBranch.getName(), remoteBranch.getSHA1());
        withReason(reason);
        withSkip(skip);
        withLocalRepo(localRepo);
        withRemoteData(remoteBranch);
    }

    public GitHubBranchCause(@NonNull String branchName, String commitSha) {
        super(commitSha, "refs/heads/" + branchName);
        this.branchName = branchName;
    }

    /**
     * Copy constructor
     */
    public GitHubBranchCause(GitHubBranchCause cause) {
        super(cause);
        this.branchName = cause.getBranchName();
    }

    public String getBranchName() {
        return branchName;
    }

    @Override
    public void fillParameters(List<ParameterValue> params) {
        GitHubBranchEnv.getParams(this, params);
    }

    @Override
    public GitHubSCMHead<GitHubBranchCause> createSCMHead(String sourceId) {