private String getCustomContextFromParameter()

in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/github/GitHubBuildContextProvider.java [20:42]


  private String getCustomContextFromParameter(@NotNull BuildPromotion buildPromotion) throws GitHubContextResolveException {
    SBuild build = buildPromotion.getAssociatedBuild();
    if (build != null) {
      String value = build.getParametersProvider().get(Constants.GITHUB_CUSTOM_CONTEXT_BUILD_PARAM);
      if (value == null) return null;

      if (isRemovedFromQueue(build) && ReferencesResolverUtil.mayContainReference(value)) {
        throw new GitHubContextResolveException("Variables in the custom context for removed from queue build cannot be resolved");
      }
      return build.getValueResolver().resolve(value).getResult();
    }

    SBuildType buildType = buildPromotion.getBuildType();
    if (buildType == null) return null;

    String value = buildType.getParameters().get(Constants.GITHUB_CUSTOM_CONTEXT_BUILD_PARAM);
    if (value == null) return null;

    if(ReferencesResolverUtil.mayContainReference(value)) {
      throw new GitHubContextResolveException("Variables in the custom context for build cannot be resolved");
    }
    return value;
  }