MCPcopy Create free account
hub / github.com/TGX-Android/Publisher / toDisplayPullRequestList

Function toDisplayPullRequestList

main.js:2182–2247  ·  view source on GitHub ↗
(build, isGitHubRelease)

Source from the content-addressed store, hash-verified

2180}
2181
2182function toDisplayPullRequestList (build, isGitHubRelease) {
2183 const remoteUrl = build.remoteUrl || (build.git ? build.git.remoteUrl : '');
2184 const toItem = (pullRequestId, pullRequestCommit, pullRequest, nextPullRequest) => {
2185 const pullRequestUrl = remoteUrl + '/pull/' + pullRequestId;
2186 let text = null;
2187 if (isGitHubRelease) {
2188 text = '**#' + pullRequestId + '**';
2189 } else {
2190 text = '<a href="' + pullRequestUrl + '"><b>' + pullRequestId + '</b></a>';
2191 }
2192 if (pullRequest) {
2193 const pullRequestSourceUrl = pullRequestUrl + '/files/' + pullRequest.commit.long;
2194 text += ' / ';
2195 if (isGitHubRelease) {
2196 text += '[' + pullRequest.commit.short + '](' + pullRequestSourceUrl + ')';
2197 } else {
2198 text += '<a href="' + pullRequestSourceUrl + '">' + pullRequest.commit.short + '</a>';
2199 }
2200 if (pullRequest.github) {
2201 if (Math.max(pullRequest.github.additions || pullRequest.github.deletions) > 0) {
2202 text += ' (';
2203 text += isGitHubRelease ? '`' : '<code>';
2204 text += [pullRequest.github.additions, -pullRequest.github.deletions].filter((item) => item !== 0).map((item) => item > 0 ? '+' + item : item.toString());
2205 text += isGitHubRelease ? '`' : '</code>'
2206 text += ')';
2207 }
2208 if (!nextPullRequest || !nextPullRequest.github || nextPullRequest.github.name !== pullRequest.github.name) {
2209 if (isGitHubRelease) {
2210 text += ' by @' + pullRequest.github.name;
2211 } else {
2212 text += ' by <a href="' + (pullRequest.github.url || 'https://github.com/' + pullRequest.github.name) + '">' + pullRequest.github.name + '</a>';
2213 }
2214 }
2215 }
2216 } else if (pullRequestCommit) {
2217 const pullRequestSourceUrl = pullRequestUrl + '/files/' + pullRequestCommit;
2218 text += ' / ';
2219 if (isGitHubRelease) {
2220 text += '[' + pullRequestCommit + '](' + pullRequestSourceUrl + ')';
2221 } else {
2222 text += '<a href="' + pullRequestSourceUrl + '">' + pullRequestCommit + '</a>';
2223 }
2224 }
2225 return text;
2226 };
2227 const separator = isGitHubRelease ? '\n' : ', ';
2228 const prefix = isGitHubRelease ? '* ' : '';
2229 if (build.pullRequestsMetadata) {
2230 return build.pullRequestsMetadata.map((pullRequestMetadata, index) => {
2231 const pullRequestId = pullRequestMetadata.id;
2232 const pullRequest = build.pullRequests ? build.pullRequests[pullRequestId] : null;
2233 const nextPullRequestId = index + 1 < build.pullRequestsMetadata.length ? build.pullRequestsMetadata[index + 1].id : null;
2234 const nextPullRequest = nextPullRequestId !== null ? build.pullRequests[nextPullRequestId] : null;
2235 return prefix + toItem(pullRequestId, pullRequestMetadata.commit, pullRequest, nextPullRequest);
2236 }).join(separator);
2237 } else if (build.pullRequests) {
2238 const pullRequestIds = Object.keys(build.pullRequests);
2239 return pullRequestIds.map((pullRequestId, index) => {

Callers 4

getBuildCaptionFunction · 0.85
uploadToGithubFunction · 0.85
processPrivateCommandFunction · 0.85
getChecksumMessageFunction · 0.85

Calls 1

toItemFunction · 0.85

Tested by

no test coverage detected