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

Function toItem

main.js:2184–2226  ·  view source on GitHub ↗
(pullRequestId, pullRequestCommit, pullRequest, nextPullRequest)

Source from the content-addressed store, hash-verified

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) {

Callers 1

toDisplayPullRequestListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected